-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Milestone
Description
Current behavior
Currently in our bug tracking software we see this error a lot. (47k occurrences in like 3 weeks)
It seems to happen when a 404 or error page gets rendered according to the error.
Don't know if I'm correct but if you do a res.redirect or something like that, you need to do a return after that so it doesn't try to do another redirect?
So if you would want to do a 404 or 500 redirect the errorHandler in server.ts would look like this:
const errorHandler = err => {
if (err && err.code === 404) {
if (NOT_ALLOWED_SSR_EXTENSIONS_REGEX.test(req.url)) {
apiStatus(res, 'Vue Storefront: Resource is not found', 404)
console.error(`Resource is not found : ${req.url}`)
return;
} else {
res.redirect('/page-not-found')
console.error(`Redirect for resource not found : ${req.url}`)
return;
}
} else {
res.redirect('/error')
console.error(`Error during render : ${req.url}`)
console.error(err)
return;
}
}
I don't have a lot of experience with express so I might be wrong.
Expected behavior
It shouldn't happen at all.
Steps to reproduce the issue
Run VSF in a production environment.
Repository
Can you handle fixing this bug by yourself?
- YES
- NO
Which Release Cycle state this refers to? Info for developer.
Pick one option.
- This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from
developbranch and create Pull Request2. Feature / Improvementback todevelop. - This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from
releasebranch and create Pull Request3. Stabilisation fixback torelease. - This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from
hotfixormasterbranch and create Pull Request4. Hotfixback tohotfix.
Environment details
- Browser: Chrome 81.0.4044.92
- OS: Mac os 10.15.1
- Node: V10.19.0
- Code Version: V1.11.0
