next.js: Fetch API cannot load webpack://%5Bname%5D_%5Bchunkhash%5D/ CORS
Bug report
Describe the bug
Cannot fetch <script src="..."/> on client successfully, encountering CORS webpack issue
VM704:1 Fetch API cannot load webpack://%5Bname%5D_%5Bchunkhash%5D/./node_modules/react-dom/cjs/react-dom.development.js?. URL scheme must be "http" or "https" for CORS request.
To Reproduce
Repo: https://github.com/notJackson/nextjs-webpack-cors-issue
Expected behavior
Run script on client
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: Ubuntu 18.04.1 LTS
- Browser: Chromium Version 72.0.3626.96 (Official Build) snap (64-bit)
- Project dependencies:
"next": "^8.0.1",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react-runkit": "^0.9.0"
Additional context
Related discussion on spectrum: https://spectrum.chat/next-js/general/upgrade-guide-from-next-6-x-to-next-7~3e83c1c4-419d-4497-b9e2-9a927cd3562b?m=MTUzNzQ2MDgxOTg1OQ==
Not relying on this to work, but figured since I already had a minimal repro repo I might as well publish this so one can eventually look into this.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 21
- Comments: 23 (8 by maintainers)
Sorry to re-wake this thread but has this actually been resolved? I’m still coming up against this issue, which doesn’t seem to be resolved. However it seems to be an issue that comes up and is closed, but I don’t feel that I understand what I am supposed to do about it — or even if I need to worry about it, since my app seems to be running fine.
https://github.com/vercel/next.js/discussions/14219, https://github.com/vercel/next.js/issues/10086, https://github.com/vercel/next.js/issues/9680, https://github.com/vercel/next.js/issues/6374
I am getting this issue while trying to work with the with-sentry example in my app as soon as I try to generate an error.
Since the comments here suggested
react-error-overlaycould be an issue, I tried to run my code in production mode and it worked fine. Please let me know if I need to provide some other details.I can confirm that react-error-overlay causes this (atleast with my project), I’ve attempted to read a field from
undefinedin getInitialProps and instead of getting a useful error message the whole thing crashed withFetch API cannot load webpack://%5Bname%5D_%5Bchunkhash%5D .....Hope this helps
I encountered the bug while integrating
react-datepickerandformik.Here is a repo for the minimal reproducible case.
To reproduce the error, start the dev server and choose a day on the datepicker.
Here is the meat of the repo:
package.json
and
Hmm…well I got it to work, but in a weird way that I think gets around this bug, but reinforces my belief that it may have something to do with next.js. Now, rather than append to an array in my setState I simply set the state to a concatenated string (see here: https://gist.github.com/patientplatypus/1857c5e30d89d2f399591acb9d56a574). My problem is definitely solved, ijjk and I appreciate the offer for support. I would suggest making a note that maybe it has something to do with setState? And also there are of course still other people with issues.
Thanks again for the suggestions guys.
Sounds like a bug in react-error-overlay 🕵️
This didn’t close the issue for me. Please consider reopening.