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.

adapter is not a function (EDIT: after 1st request)

See original GitHub issue

Edit:

I originally thought this was only happening in the DELETE request. It turns out that any request after the first request fails . So if I send the POST and then the POST again, the 2nd time it fails.

TypeError: adapter is not a function
    at dispatchRequest (dispatchRequest.js:52)
    at async http:/localhost:3004/launchpad/static/js/205.chunk.js:537

Hi there

In the same page we have several calls to axios.get, axios.post and those work fine.

But using axios.delete I’m getting a weird error

adapter is not a function

I inspected into axios’ code and found that effectively, defaults.adapter is undefined

image (20)

Weird thing is that in other verbs (get, post), adapter is a function (I think is xhrAdapter or something like that)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:22

github_iconTop GitHub Comments

24reactions
softmarshmallowcommented, Oct 29, 2020
import axiosOriginal from 'axios'
import adapter from 'axios/lib/adapters/xhr'

const axios = axiosOriginal.create({ adapter })

XMLHttpRequest is not defined

13reactions
yennorcommented, Dec 13, 2020

I’ve had the same problem. But my problem was, that I tried to use Axios inside of a service worker. Unfortunately that doesn’t work since axios can’t work inside of a worker, because of: https://github.com/axios/axios/issues/1219 So the above solution didn’t work (obviously)

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: adapter is not a function error when using axios ...
I've tried using node-fetch and axios and neither is working for me. My webpack.common.js file looks like this: const path = require("path"); ...
Read more >
Debug Adapter Protocol - Microsoft Open Source
The Debug Adapter Protocol defines the protocol used between an editor or IDE and a debugger or runtime. A machine-readable JSON schema can...
Read more >
Troubleshoot invocation issues in Lambda
Invocation errors can be caused by issues with request parameters, event structure, function settings, user permissions, resource permissions, or limits. If you ...
Read more >
A device driver is not installed or a hardware device does not ...
Resolution · Step 1: Determine whether the device driver is found in Device Manager · Step 2: Uninstall and reinstall the device drivers...
Read more >
Writing middleware in #golang and how Go makes it so much ...
Our Adapt function will simply iterate over all adapters, calling them one by one (in reverse order) in a chained manner, returning the...
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 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