You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open any static asset in the _nuxt folder (e.g., /_nuxt/foo-bar.js).
If the asset doesn't exist on the server:
Nuxt returns a 404 error.
Before returning the error, it initializes the nuxt instance and calls the API endpoint to retrieve user data for each non-existent file.
Describe the bug
When Nuxt accesses static assets in the _nuxt folder:
If the file exists, Nuxt serves its content as expected.
If the file does not exist (e.g., after deployment), Nuxt returns a 404 error but first:
Initializes an instance of the auth middleware.
Makes an API request to fetch authenticated user data, even though this is unnecessary for static assets.
This behavior can result in a significant number of redundant API calls when multiple missing files are requested (e.g., during deployment or cache misses). If 10 JavaScript files result in 404 errors (e.g., after deployment), this could trigger 10 API calls to the getSession endpoint specified in the Nuxt configuration.
Additional context
A temporary workaround involves disabling server-side authentication for static routes in the Nuxt configuration.
Environment
Reproduction
nuxt.config.ts:
Describe the bug
When Nuxt accesses static assets in the _nuxt folder:
This behavior can result in a significant number of redundant API calls when multiple missing files are requested (e.g., during deployment or cache misses). If 10 JavaScript files result in 404 errors (e.g., after deployment), this could trigger 10 API calls to the getSession endpoint specified in the Nuxt configuration.
Additional context
A temporary workaround involves disabling server-side authentication for static routes in the Nuxt configuration.
Example Configuration:
Logs
The text was updated successfully, but these errors were encountered: