Fetch API cannot load file:///path/to/react-dom-server.node.development.js. URL scheme must be "http" or "https" for CORS request.
See original GitHub issueBug Report
Describe the bug
Cannot fetch <script src="..."/> on client successfully, encountering CORS issue, similar to #6374.
Fetch API cannot load file:///D:/_projects/next-learn-demo/6-fetching-data/node_modules/react-dom/cjs/react-dom-server.node.development.js. URL scheme must be "http" or "https" for CORS request.
To Reproduce
- Clone https://github.com/jdmallen/next-learn-demo
- Checkout branch
fetch-cors-bug
. - Navigate to
./6-fetching-data
- Execute
npm i && npm run dev
Expected Behavior
Runs script on client.
Screenshots
System Information
- Windows 10 1809
- Chrome 79.0.3945.117 (Official Build) (64-bit)
- Next 9.1.7
- Project dependencies: “isomorphic-unfetch”: “^3.0.0”, “next”: “^9.0.0”, “react”: “^16.8.4”, “react-dom”: “^16.8.4”
Additional context
All I did was change MyLayout to use a higher order function withLayout
as suggested in your tutorial here and update each file to use it as shown in this fork.
Without withLayout
– i.e. just using <Layout>...</Layout>
component-- it works as expected.
Related to issue #6374, but this time only using packages referenced by your tutorial. Please advise. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Fetch API cannot load URL scheme must be "http" or "https" for ...
Open a terminal, navigate to the directory with your index file and type npx serve . This will fetch https://www.npmjs.com/package/serve and ...
Read more >Fetch API cannot load file:///path/to/react-dom-server.node ...
Fetch API cannot load file:///path/to/react-dom-server.node.development.js. URL scheme must be "http" or "https" for CORS request. #10086.
Read more >Using the Fetch API - MDN Web Docs
The Fetch API provides a JavaScript interface for accessing and manipulating parts of the protocol, such as requests and responses.
Read more >Fetch: Cross-Origin Requests - The Modern JavaScript Tutorial
If we send a fetch request to another web-site, it will probably fail. For instance, let's try fetching http://example.com :.
Read more >d failed to fetch. possible reasons: cors network ... - You.com
CORS ; Network Failure; URL scheme must be "http" or "https" for CORS request. ... API cannot load file:///path/to/react-dom-server.node.development.js. URL ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Getting the same with fetching-data-for-pages
Next.js Version: 9.3.2
I get the same error when I’m using HOC’s