-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"(node:20862) UnhandledPromiseRejectionWarning: FetchError: network timeout" when API answer exceeds predefined timeout #483
Comments
Please adjust Jasmine timeout in either way.(default: 5[ms])
|
@H1Gdev Thanks for your answer. `'use strict' frisby.timeout(500) //.setup({request:{timeout: 300}}) And I see that timeout value is set as needed but when endpoint answer time exceeds timeout it throws this error. |
I understood your runtime environment. Frisby is test framework based on Promise. Update your code. 'use strict'
const frisby = require('frisby');
const Joi = frisby.Joi;
const baseUrl = 'https://dev.com:443/api/v1.1/';
const defaultJoiOptions = { convert: false, presence: "required" }
frisby.timeout(500) //.setup({request:{timeout: 300}})
.get(baseUrl+'~info')
.inspectResponse()
.inspectJSON()
.expect('jsonTypes', {
meta: Joi.object({
status: Joi.string().valid('ok').error(() => 'status must be: "ok"'),
error: Joi.equal(null)
}).options(defaultJoiOptions),
})
.catch(err => { // <- add catch.
// catch network timeout and Joi error.
console.log('error', error.message);
}); |
Did you solve this issue? |
If you |
Environment:
Frisby 2.1.0 (it works fine on 2.0.16), Node: v10.6.0, Ubuntu 18.04,
Test code snippet:
frisby.timeout(400) // or using .setup({request:{timeout: 400}}) .get(baseUrl+'~info').inspectResponse()
Full ERROR log:
(node:20862) UnhandledPromiseRejectionWarning: FetchError: network timeout at: https://dev.com:443/api/v1.1/~info at Timeout.<anonymous> (/home/and/Desktop/api-test/node_modules/node-fetch/lib/index.js:1338:13) at ontimeout (timers.js:427:11) at tryOnTimeout (timers.js:289:5) at listOnTimeout (timers.js:252:5) at Timer.processTimers (timers.js:212:10) (node:20862) UnhandledPromiseRejectionWarning: FetchError: network timeout at: https://dev.com:443/api/v1.1/~info warning.js:18 at Timeout.<anonymous> (/home/and/Desktop/api-test/node_modules/node-fetch/lib/index.js:1338:13) at ontimeout (timers.js:427:11) at tryOnTimeout (timers.js:289:5) at listOnTimeout (timers.js:252:5) at Timer.processTimers (timers.js:212:10)
PS thank you for development this very handy tool.
The text was updated successfully, but these errors were encountered: