Contentful (axios) throws: TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
See original GitHub issueEnvironment
Name | Version |
---|---|
msw | 0.39.0 |
node | v16.13.0 |
OS | Windows 10 |
Request handlers
See a complete reproducible repo here. Just npm i
and then node app.js
.
Current behavior
Mocking a minimal get request to Contentful’s readonly API causes msw/NodeClientRequest.Client
request to throw:
TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
…akin to previous issues, but something new must be going on here. Under the hood Contentful uses axios, which might shed some light on the cause. If I revert back to 0.36.8
this issue does not happen (but has its own set of issues).
Expected behavior
For msw to intercept the request successfully and return a mocked response.
Screenshots
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Node js Error: Protocol "https:" not supported. Expected "http:"
My project needs to request a JSON from an API, so I can use the data it provides. I use the http get...
Read more >contentful.js - Documentation
contentful.js. /** * Contentful Delivery API SDK. Allows you to create instances of a client * with access to the Contentful Content Delivery...
Read more >Node Js Error: Protocol "Https:" Not Supported ... - ADocLib
Please You can generate a new API key in the Cloud Console. TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:" at new NodeError ......
Read more >@contentful/axios - npm
Promise based HTTP client for the browser and node.js. Latest version: 0.18.0, last published: 5 years ago. Start using @contentful/axios in ...
Read more >Node js Error: Protocol "https:" not supported. Expected "http:"
I got this error while deploying the code. INFO error=> TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:" at ...
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 FreeTop 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
Top GitHub Comments
Just for other peoples’ future reference. This was a matter of passing node’s
https.Agent()
to the Contentful client paramhttpsAgent
during instantiation. Thanks for your help @kettanaito.🎉 This issue has been resolved in version 0.39.1 🎉
The release is available on:
Your semantic-release bot 📦🚀