Description
Summary
Netlify triggers a new ODB function instead of returning the expected 404 when using fallback: false
.
Context:
We have a top level dynamic route, so that we can create new landing pages directly from our CMS. Because fallback: false
was ignored, every request to myWebsite.com/:uid
resulted in a new ODB function being triggered. However, these requests were for example also triggered by crawlers requesting robots.txt
(which was missing at that time). Another edge case leading to a huge number of function invocations was the usage of the nextjs Link
component for a route with a configured redirect (in _redirects). Because Nextjs prefetches routes, it tried to prefetch the JSON of the route (which didn't exist because it's a redirect). This would not have been a problem (only a failed request in the network tab of the browser, and it can be fixed by disabling the prefetching)...However, with Netlify ignoring fallback: false
, a new ODB function was spawned for every prefetch request (which could be many per user session).
All in all we accumulated 170k+ function invocations in one weekend. I know that the above described scenario is very specific (and could have been avoided) but I wanted to emphasize, that the i18n fix can result in some unpleasent surprises for Netlify customers that use fallback: false
and expect it to work as described in the nextjs docs.
Steps to reproduce
.
A link to a reproduction repository
No response
Plugin version
4.2.1
More information about your build
- I am building using the CLI
- I am building using file-based configuration (
netlify.toml
)
What OS are you using?
No response
Your netlify.toml file
`netlify.toml`
# Paste content of your `netlify.toml` file here
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your next.config.js
file
`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.
Builds logs (or link to your logs)
Build logs
# Paste logs here
Function logs
Function logs
# Paste logs here
.next JSON files
generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.