Skip to content
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

Break app when not importing Axios defaults #346

Closed
dsebastien opened this issue Feb 10, 2021 · 1 comment
Closed

Break app when not importing Axios defaults #346

dsebastien opened this issue Feb 10, 2021 · 1 comment

Comments

@dsebastien
Copy link

Apparently, if Axios is used like this when axios-cookiejar-support is part of an app, then it breaks:

import { request } from "axios";
request({
  url: "https://www.google.be",
}).then(r => console.log(r));

Here's the error that I get:

/home/sebastien/wks/didowi/node_modules/axios-cookiejar-support/lib/index.js:58
    const mergedConfig = mergeConfig(_defaults.default, mergeConfig(this.defaults, config));
                                                                         ^
TypeError: Cannot read property 'defaults' of undefined
    at request (/home/sebastien/wks/didowi/node_modules/axios-cookiejar-support/lib/index.js:58:74)
    at Module../apps/gate/src/main.ts (/home/sebastien/wks/didowi/dist/apps/gate/webpack:/apps/gate/src/main.ts:50:8)
    at __webpack_require__ (/home/sebastien/wks/didowi/dist/apps/gate/webpack:/webpack/bootstrap:19:1)
    at Object.0 (/home/sebastien/wks/didowi/dist/apps/gate/main.js:29245:18)
    at __webpack_require__ (/home/sebastien/wks/didowi/dist/apps/gate/webpack:/webpack/bootstrap:19:1)
    at /home/sebastien/wks/didowi/dist/apps/gate/webpack:/webpack/bootstrap:83:1
    at Object.<anonymous> (/home/sebastien/wks/didowi/dist/apps/gate/main.js:87:10)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)

I think that this package is added to my application through nano, the client library for CouchDB: https://github.com/apache/couchdb-nano.

Here's what they're doing with it: https://github.com/apache/couchdb-nano/pull/245/files

I'm facing this issue while working on something completely different by the way: auth0/node-jwks-rsa#215

Any idea how to fix this? Should the node-jwks-rsa library use import Axios like this? const axios = require('axios').default; or is it supposed to work if they do import { get } from "axios"; ?

@dsebastien dsebastien changed the title Break app when using default imports Break app when using default axios imports Feb 10, 2021
@dsebastien dsebastien changed the title Break app when using default axios imports Break app when not importing Axios defaults Feb 10, 2021
@3846masa
Copy link
Owner

Sorry for the delay in response.
This issue has been resolved with the release of v2.0.0.

If you think this issue is still unresolved, please reopen it.

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

No branches or pull requests

2 participants