cloudflare / cloudflare/worker-sites-template
Options object ignored, when getting "404.html"
- Dominant language
- HTML
- Stars
- 79
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
If `DEBUG` is set to false, the request that fetches the 404 page doesn' honor the options that are set above.
I have changed the [following](https://github.com/cloudflare/worker-sites-template/blob/0adcb0e9d51654c6d7987189463e757b2815c8e8/workers-site/index.js#L62):
```javascript
let notFoundResponse = await getAssetFromKV(event, {
mapRequestToAsset: req => new Request(`${new URL(req.url).origin}/404.html`, req),
})
```
...to this:
```javascript
options.mapRequestToAsset = req =>
new Request(`${new URL(req.url).origin}/404.html`, req)
let notFoundResponse = await getAssetFromKV(event, options)
```
...which fixed the problem.
Contributor guide
Assessment
This issue has not been assessed yet.