Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

reqConfig.adapter is not a function #272

Open
TheNhatAT opened this issue Feb 1, 2023 · 2 comments
Open

reqConfig.adapter is not a function #272

TheNhatAT opened this issue Feb 1, 2023 · 2 comments

Comments

@TheNhatAT
Copy link

I have face that issue when run axios-cache-adapter version 2.7.3.
Full error message:
reqConfig.adapter is not a function {
stack: 'TypeError: reqConfig.adapter is not a function\n' +
' at _callee$ (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\webpack:\axiosCacheAdapter\src\api.js:35:29)\n' +
' at tryCatch (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\webpack:\axiosCacheAdapter\node_modules\regenerator-runtime\runtime.js:63:15)\n' +
' at Generator.invoke [as _invoke] (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\webpack:\axiosCacheAdapter\node_modules\regenerator-runtime\runti
me.js:293:1)\n' +
' at Generator.next (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\webpack:\axiosCacheAdapter\node_modules\regenerator-runtime\runtime.js:118:1)\n'
+
' at asyncGeneratorStep (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\cache.node.js:4083:103)\n' +
' at _next (C:\Users\dmx\WebstormProjects\VAR\Gamemaketplace\polka-env\gmp-backend\node_modules\axios-cache-adapter\dist\cache.node.js:4085:194)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:96:5)',
[Symbol(level)]: 'error'
}

@shameen
Copy link

shameen commented Feb 7, 2023

Downgrade to "axios": "1.1.x" (or 0.21 to match the version this package specifies)

i had the same problem, and it looks like it is caused by config.js setting the default adapter:
https://github.com/RasCarlito/axios-cache-adapter/blob/master/src/config.js#L23

This was changed in axios v1.2+ from a function to a string or string array: axios/axios@d032edd#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8L293-R297
and the adapters themselves were moved to axios/lib/adapters/.

I couldn't find an easy workaround because axios/lib/adapters/ can't be imported (due to axios package.json exports)

@arthurfiorette
Copy link

Hey, axios-cache-adapter is broken for axios v1 and unmaintained since 2021.

I'm the maintainer of https://axios-cache-interceptor.js.org, you should check it out...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants