question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is it possible to use axios in google chrome extension

See original GitHub issue

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

export function do_post(url:string,data:any){
    axios.post(url, JSON.stringify(data))
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
}

Expected behavior, if applicable

the background could successfully send a http request

Environment

  • Axios Version [e.g. 0.25.0]
  • Adapter [e.g. FETCH]
  • Browser [e.g. Chrome]
  • Browser Version [e.g. 90]
  • Node.js Version [e.g. 16]
  • OS: [e.g. OSX 10.13.4]
  • Additional Library Versions [Vue 3]

Additional context/Screenshots

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
mehimanshupatilcommented, Mar 7, 2022
0reactions
Myzel394commented, Nov 21, 2022

@mehimanshupatil Thank you, so the version seemed to be the problem. I was using version 1.1.3. However, version 0.27.2 is kinda old, I’ll instead use good old fetch and fetch-intercept.

EDIT

I just found out that axios==0.27.2 isn’t that old, axios just did a huge jump from 0.27.2 to 1.0.0 directly (https://www.npmjs.com/package/axios?activeTab=versions), so I think using it is still ok. What do you think @mehimanshupatil ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I add the axios package to my chrome extension I'm ...
External modules like axios would need to be bundled into your chrome extension in order for it to work as you intend. You...
Read more >
axios-chrome-messaging-adapter - npm
Axios adapter using Chrome Extensions Messaging to perform requests from the background page.. Latest version: 0.6.0, last published: 8 ...
Read more >
How to build a Chrome extension that makes API calls.
How to build a Chrome extension that makes API calls. · 1.Create a new directory and navigate into that directory. · 2.We need...
Read more >
Axios - Apps on Google Play
News worthy of your time: Axios' expert journalists cut through the noise by reporting only facts that matter. Our concise reporting helps you...
Read more >
You.com raises $25 million to take on Google's search ... - Axios
Its results, however, are organized differently and can be personalized by adding apps in areas like news (Axios is in there) or code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found