mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
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
This commit is contained in:
parent
0ce8c65960
commit
9a8024d5c9
14
website/api/controllers/entrance/signup.js
vendored
14
website/api/controllers/entrance/signup.js
vendored
@ -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) {
|
||||
|
5
website/views/pages/try-fleet/register.ejs
vendored
5
website/views/pages/try-fleet/register.ejs
vendored
@ -36,13 +36,16 @@
|
||||
<div class="invalid-feedback mt-2" v-if="formErrors.password === 'required'">Please enter a password.</div>
|
||||
</div>
|
||||
<ajax-button style="height: 53px;" purpose="submit-button" spinner="true" type="submit" :syncing="syncing" class="btn btn-block btn-lg btn-info" v-if="!cloudError">Sign up</ajax-button>
|
||||
<div class="d-flex flex-column" v-if="cloudError==='emailAlreadyInUse'">
|
||||
<div class="d-flex flex-column" v-if="cloudError === 'emailAlreadyInUse'">
|
||||
<cloud-error class="my-0">
|
||||
<p purpose="error-message">This email is already linked to a Fleet account.</p>
|
||||
</cloud-error>
|
||||
<a class="mx-auto font-weight-bold d-flex align-items-center py-3" href="/try-fleet/login">Sign in with existing account <img alt="A blue arrow pointing right" style="height: 10px; margin-left: 6px;" src="/images/arrow-right-blue-18x10@2x.png"></a>
|
||||
<ajax-button style="height: 53px;" purpose="submit-button" spinner="true" type="submit" :syncing="syncing" class="btn btn-block btn-lg btn-info">Try again</ajax-button>
|
||||
</div>
|
||||
<cloud-error purpose="cloud-error" v-else-if="cloudError === 'requestToSandboxTimedOut'">
|
||||
<p purpose="error-message">Fleet Sandbox is experiencing unusually high activity. Please refresh the page in 13 seconds and try signing up again.</p>
|
||||
</cloud-error>
|
||||
<cloud-error purpose="cloud-error" v-else-if="cloudError"></cloud-error>
|
||||
</ajax-form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user