wrap openid-config request in try/catch
This commit is contained in:
parent
555c615711
commit
017bb0d146
@ -9,6 +9,7 @@ async function getFxaConfig() {
|
|||||||
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
||||||
return fxaConfig;
|
return fxaConfig;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${config.fxa_url}/.well-known/openid-configuration`,
|
`${config.fxa_url}/.well-known/openid-configuration`,
|
||||||
{ timeout: 3000 }
|
{ timeout: 3000 }
|
||||||
@ -16,6 +17,9 @@ async function getFxaConfig() {
|
|||||||
fxaConfig = await res.json();
|
fxaConfig = await res.json();
|
||||||
fxaConfig.key_scope = KEY_SCOPE;
|
fxaConfig.key_scope = KEY_SCOPE;
|
||||||
lastConfigRefresh = Date.now();
|
lastConfigRefresh = Date.now();
|
||||||
|
} catch (e) {
|
||||||
|
// continue with previous fxaConfig
|
||||||
|
}
|
||||||
return fxaConfig;
|
return fxaConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user