From 9a8024d5c9ba56328e4bea6c7ac51e67c68937b4 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 14 Feb 2023 11:58:12 -0600 Subject: [PATCH] Website: Update `signup.js` error handling and increase timeout in Sandbox provisioner request (#9818) Changes: - Updated `signup.js` to: - Add a new exit: `requestToSandboxTimedOut` - Increased the timeout on the request to the Fleet Sandbox provisioner from 5000ms to 10000ms - Changed the error thrown when a request times out to a logged warning. - return the `requestToSandboxTimedOut` exit when a request to the Fleet Sandbox provisioner times out. - Added an error message to the Sandbox registration page for when requests time out --- website/api/controllers/entrance/signup.js | 14 ++++++++++---- website/views/pages/try-fleet/register.ejs | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/website/api/controllers/entrance/signup.js b/website/api/controllers/entrance/signup.js index e708fd054d..9487382daa 100644 --- a/website/api/controllers/entrance/signup.js +++ b/website/api/controllers/entrance/signup.js @@ -79,6 +79,11 @@ the account verification message.)`, 'parameters should have been validated/coerced _before_ they were sent.' }, + requestToSandboxTimedOut: { + statusCode: 408, + description: 'The request to the cloud provisioner exceeded the set timeout.', + }, + emailAlreadyInUse: { statusCode: 409, description: 'The provided email address is already in use.', @@ -123,14 +128,15 @@ the account verification message.)`, 'Authorization':sails.config.custom.cloudProvisionerSecret } ) - .timeout(5000) + .timeout(10000)// FUTURE: set this timeout to be 5000ms .intercept(['requestFailed', 'non200Response'], (err)=>{ // If we received a non-200 response from the cloud provisioner API, we'll throw a 500 error. return new Error('When attempting to provision a new user who just signed up ('+emailAddress+'), the cloud provisioner gave a non 200 response. The incomplete user record has not been saved in the database, and the user will be asked to try signing up again. Raw response received from provisioner: '+err.stack); }) - .intercept({name: 'TimeoutError'}, (err)=>{ - // If the request timed out, we'll throw a 500 error. - return new Error('When attempting to provision a new user who just signed up ('+emailAddress+'), the request to the cloud provisioner took over timed out. The incomplete user record has not been saved in the database, and the user will be asked to try signing up again. Raw error: '+err.stack); + .intercept({name: 'TimeoutError'},(err)=>{ + // If the request timed out, log a warning and return a 'requestToSandboxTimedOut' response. + sails.log.warn('When attempting to provision a new user who just signed up ('+emailAddress+'), the request to the cloud provisioner took over timed out. The incomplete user record has not been saved in the database, and the user will be asked to try signing up again. Raw error: '+err.stack); + return 'requestToSandboxTimedOut'; }); if(!cloudProvisionerResponseData.URL) { diff --git a/website/views/pages/try-fleet/register.ejs b/website/views/pages/try-fleet/register.ejs index 41dcd3776a..851bba0937 100644 --- a/website/views/pages/try-fleet/register.ejs +++ b/website/views/pages/try-fleet/register.ejs @@ -36,13 +36,16 @@
Please enter a password.
Sign up -
+

This email is already linked to a Fleet account.

Sign in with existing account A blue arrow pointing right Try again
+ +

Fleet Sandbox is experiencing unusually high activity. Please refresh the page in 13 seconds and try signing up again.

+