diff --git a/packages/cli/src/response-helper.ts b/packages/cli/src/response-helper.ts index 0dff1625cb..2b993c266c 100644 --- a/packages/cli/src/response-helper.ts +++ b/packages/cli/src/response-helper.ts @@ -103,6 +103,14 @@ export function sendErrorResponse(res: Response, error: Error) { } } + if (error.errorCode === 409 && originalUrl && originalUrl.includes('form-waiting')) { + //codes other than 200 breaks redirection to form-waiting page from form trigger + //render form page instead of json + return res.render('form-trigger-409', { + message: error.message, + }); + } + httpStatusCode = error.httpStatusCode; if (error.errorCode) { diff --git a/packages/cli/templates/form-trigger-409.handlebars b/packages/cli/templates/form-trigger-409.handlebars new file mode 100644 index 0000000000..6f34e5080d --- /dev/null +++ b/packages/cli/templates/form-trigger-409.handlebars @@ -0,0 +1,74 @@ + + +
+ + + + +{{message}}
+