-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
is it possible to use axios in google chrome extension #4458
Comments
Hey @jiangxiaoqiang, were you able to resolve the error? |
I did not solve the error, I am using the original fetch to do a simple interceptor in the wrapper function right now. |
as mentioned here https://stackoverflow.com/a/70206333/9740955 |
Solved my problem, thanks |
Closing as this seems to be solved, please create anew issue should you think it still needs attention |
@mehimanshupatil and @kiwiflydream how did you manage to load axios? I tried to override the adapter, but axios already throws an error as soon as it gets imported ( |
@Myzel394 the example mentioned in @vespaiach/axios-fetch-adapter readme.md which you can refer to. also, make sure you use Axios version 0.27.2. you can share your code |
@mehimanshupatil Thank you, so the version seemed to be the problem. I was using version EDIT I just found out that |
Has anyone successfully set up Axios newer version with a fetch adapter in a Chrome Extension's service worker? |
@rezasohrabi Axios has just published I tried @vespaiach/axios-fetch-adapter and noticed that this package is not compatible with axios v1. I tended to create a new adapter but when looking at axios repo, they released the fetch adapter yesterday :) Chrome Extension has mentioned about Fetch vs XHR API. XHR can't be used in service worker and also in newtab page in my case, but It can be used in content script and popup page https://developer.chrome.com/docs/extensions/develop/concepts/network-requests#fetch_vs_xmlhttprequest |
Describe the issue
is it possible to user axios in google chrome extension? when I am using axios in google chrome extension, shows error:
TypeError: adapter is not a function
at dispatchRequest (background.js:836:10)
at Axios.request (background.js:599:15)
at Axios.post (background.js:634:17)
at Function.wrap [as post] (background.js:1276:15)
at do_post (background.js:2418:50)
at handleTransImpl (background.js:2370:72)
at handleMessage (background.js:2551:94)
at background.js:2546:5
this is the detail info:
https://stackoverflow.com/questions/70922718/is-it-possible-to-change-the-axios-adapter-the-axios-did-not-support-fetch-adap
Example Code
Expected behavior, if applicable
the background could successfully send a http request
Environment
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: