-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serveStatic API doesn't work as expected since 9.3.2 #11751
Comments
At first I was thinking that embedding minified versions of The error seems to be thrown here: I stopped debugging after this file as I don't know how to go further :( |
I can confirm this. Downloaded the code from scratch and just get 404 on every blog page |
I can confirm this issue as well. I have a similar setup to serve a service worker and I'm getting the same result. |
I can confirm this issue on 9.3.5. Downgrading back to 9.3.1 solves it. |
redacted |
have anyone checked if this is fixed on 9.4.x? |
The error is still present on 9.4.0 |
need to use /service-worker.js on latest next.js |
You can move this file into |
For those who's looking for the solution,
This works for me. |
I'm uploading files to /public but I can't serve anymore those files (404) unless I trigger a rebuild. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When using a custom server, the API
app.serveStatic(req, res, filePath)
is used to return static files, but the server returns a404
error page, even though the file is present on disk.I'm using a custom
server.js
to run next and serve a service worker config produced at runtime bynext-offline
.After upgrading from
9.3.1
to9.3.2
, the file cannot be served as the server returns a404
.To Reproduce
With the following
server.js
:in your shell run
The file content is correctly served at
http://localhost:3000/service-worker.js
Then run:
The url
http://localhost:3000/service-worker.js
returns a404
and shows the default error page.Expected behavior
The file should be served consistently accross versions
Screenshots
N/A
System information
Additional context
Here is the
console.log
extract fromserver.js
showing that the file is present when the404
is returned:The text was updated successfully, but these errors were encountered: