You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/04/14 17:16:29 UTC

[GitHub] [couchdb-nano] qxygene opened a new issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

qxygene opened a new issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264


    Uncaught TypeError: axiosCookieJarSupport is not a function
   at Object.eval (nano.js?e764:19)
   
   nano.js
   const axiosCookieJarSupport = require('axios-cookiejar-support').default
   axiosCookieJarSupport(axios)
   
   What is wrong with this?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] LyteFM edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
LyteFM edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-973957664


   Related: https://github.com/apache/couchdb-nano/issues/254
   
   In case this helps anyone:
   
   - In a library that _directly_ uses `nano 9.0.5` and Typescript, I don't have any issues - all tests run through. According to the `package-lock.json`, it resolves as:
   
   ```
       "nano": {
         "version": "9.0.5",
         "resolved": "https://registry.npmjs.org/nano/-/nano-9.0.5.tgz",
         "integrity": "sha512-fEAhwAdXh4hDDnC8cYJtW6D8ivOmpvFAqT90+zEuQREpRkzA/mJPcI4EKv15JUdajaqiLTXNoKK6PaRF+/06DQ==",
         "requires": {
           "@types/tough-cookie": "^4.0.0",
           "axios": "^0.21.1",
           "axios-cookiejar-support": "^1.0.1",
           "qs": "^6.9.4",
           "tough-cookie": "^4.0.0"
         },
         "dependencies": {
           "qs": {
             "version": "6.10.1",
             "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
             "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
             "requires": {
               "side-channel": "^1.0.4"
             }
           }
         }
   ```
   
   - But when I use that package in a different javascript project, I get the following warning during the installation:
   
   ```
   npm WARN axios-cookiejar-support@1.0.1 requires a peer of tough-cookie@>=2.3.3 but none is installed. You must install peer dependencies yourself.
   ```
   
   - And I get an error _„Cannot find module 'tough-cookie'”_. After installing `tough-cookie` in that project, everything works fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989056083


   This error doesn't happen under "normal" circumstances as @glynnbird mentioned. However, if you are using a framework like Next.js, this error will appear if you don't place fetch calls under `getStaticProps` or `getStaticPaths`. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989282116


   Update:
   
   As @glynnbird  mentioned, the package works fine under "normal" circumstances. In my case, the library doesn't work when integrating with Next.js. 
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] njmaeff commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
njmaeff commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-1035593085


   This is the issue right here
   https://github.com/apache/couchdb-nano/blob/7211bc71b1f52905ca4bf7fed82e68e5d049565e/lib/nano.js#L17
   
   
   axios-cookiejar-support version 1.0.1 as no `default` export for its noop function which is used in the browser.
   https://github.com/3846masa/axios-cookiejar-support/blob/39c2d72ec40880cd1070d3c122f48e82f510f198/noop.js#L1-L7
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev removed a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev removed a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989282116


   Update:
   
   As @glynnbird  mentioned, the package works fine under "normal" circumstances. In my case, the library doesn't work when integrating with Next.js. 
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] PlkMarudny commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
PlkMarudny commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-939702099


   The same with vite


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] LyteFM commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
LyteFM commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-994559412


   I my case, I think it relates to how dependencies are resolved by npm and when running `npm ci --production`. I got the error in a NestJS-project where I have:
   
   -  `node_modules/jsdom/node_modules/tough-cookie` (version 4.0.0) with `"dev": true`
   -  `node_modules/nano/node_modules/tough-cookie` (version 4.0.0) as production dependency 
   -  `node_modules/tough-cookie` itself previously resolved with `"version": "2.5.0", "dev": true`. (as dependency of `cypress`)
   
   And after explicitly installing `"tough-cookie": 4.0.0`, it works and it resolves as:
   
   - `"node_modules/@cypress/request/node_modules/tough-cookie"` with `"version": "2.5.0", "dev": true`.
   - `"node_modules/tough-cookie"` with `"version": "4.0.0"` as production dependency
   
   
   The error I got looks like the dependency was simply missing in the `node_modules`:
   
   ```
   internal/modules/cjs/loader.js:905
   throw err;
    ^
   Error: Cannot find module 'tough-cookie'
   Require stack:
    - .../node_modules/axios-cookiejar-support/lib/interceptors/request.js
    - .../node_modules/axios-cookiejar-support/lib/index.js
   - .../node_modules/nano/lib/nano.js
    - /mymodule/utils/db.js
    - /mymodule/myScript.js
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
        at Function.Module._load (internal/modules/cjs/loader.js:746:27)
        at Module.require (internal/modules/cjs/loader.js:974:19)
        at require (internal/modules/cjs/helpers.js:93:18)
        at Object.<anonymous> (.../node_modules/axios-cookiejar-support/lib/interceptors/request.js:8:43)
        at Module._compile (internal/modules/cjs/loader.js:1085:14)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
        at Module.load (internal/modules/cjs/loader.js:950:32)
        at Function.Module._load (internal/modules/cjs/loader.js:790:12)
        at Module.require (internal/modules/cjs/loader.js:974:19) {
     code: 'MODULE_NOT_FOUND',
     requireStack: [
       '.../node_modules/axios-cookiejar-support/lib/interceptors/request.js',
       '.../node_modules/axios-cookiejar-support/lib/index.js', 
       '.../node_modules/nano/lib/nano.js',
       '.../mymodule/utils/db.js',
       '.../mymodule/MyScript.js'
    node[5036]:   ]
    node[5036]: }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989056083


   Has anybody been able to figure this out? I am currently following Typescript documentation and the problem still persists. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] SanSiren commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
SanSiren commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-839479751


   I get the same error. I try to connect to the database like it says in your documentation:
   `const nano = require('nano')('http://localhost:5984')`
   but get the error mentioned above.
   
   ![image](https://user-images.githubusercontent.com/2650171/117926250-c57eff00-b2f8-11eb-9544-1cf4772bf7b4.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] LyteFM commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
LyteFM commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-973957664


   In case this helps anyone:
   
   - In a library that _directly_ uses `nano 9.0.5` and Typescript, I don't have any issues - all tests run through. According to the `package-lock.json`, it resolves as:
   
   ```
       "nano": {
         "version": "9.0.5",
         "resolved": "https://registry.npmjs.org/nano/-/nano-9.0.5.tgz",
         "integrity": "sha512-fEAhwAdXh4hDDnC8cYJtW6D8ivOmpvFAqT90+zEuQREpRkzA/mJPcI4EKv15JUdajaqiLTXNoKK6PaRF+/06DQ==",
         "requires": {
           "@types/tough-cookie": "^4.0.0",
           "axios": "^0.21.1",
           "axios-cookiejar-support": "^1.0.1",
           "qs": "^6.9.4",
           "tough-cookie": "^4.0.0"
         },
         "dependencies": {
           "qs": {
             "version": "6.10.1",
             "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
             "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
             "requires": {
               "side-channel": "^1.0.4"
             }
           }
         }
   ```
   
   But when I use that package in a different javascript project, I get the following warning during the installation:
   
   ```
   npm WARN axios-cookiejar-support@1.0.1 requires a peer of tough-cookie@>=2.3.3 but none is installed. You must install peer dependencies yourself.
   ```
   
   And I get an error _„Cannot find module 'tough-cookie'”_. After installing `tough-cookie` in that project, everything works fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] OliverAndersRWE commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
OliverAndersRWE commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-967213499


   Hi, I have the same problem in a vue application, but using only : 
   ```
   var nano   = require('nano')({
     'url': 'http://server:5982/'
   });
   
   nano.auth("user", "pw", function (err, body, headers) {
     if (err) {
         return console.log(err);
     }
     if (headers && headers['set-cookie']) {
         console.log(headers['set-cookie']);
         var nano   = require('nano')({
             'url':'http://server:5982/',
             'cookie': headers['set-cookie']
         })
         console.log(nano)
      
     }
   
   ```
   
   
   Error message:
   `Uncaught TypeError: axiosCookieJarSupport is not a function
       at Object.eval (nano.js?e764:19)
       at eval (nano.js:1265)
       at Object../node_modules/nano/lib/nano.js (chunk-vendors.js:3656)
       at __webpack_require__ (app.js:849)
       at fn (app.js:151)
       at eval (main.js?56d7:11)
       at Module../src/main.js (app.js:1148)
       at __webpack_require__ (app.js:849)
       at fn (app.js:151)
       at Object.1 (app.js:1161)`
   
   Any help is really appreciated...
   
   Kind Regards
   Oliver


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] LyteFM edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
LyteFM edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-1077371049


   With current versions of NestJS, `@nestjs/axios` and `axios-cookiejar-support`, I ran into the issue again. Replacing
   
   ```
    const axiosCookieJarSupport = require('axios-cookiejar-support').default
   ```
   
   with
   
   ```
   const axiosCookieJarSupport = require('axios-cookiejar-support').wrapper
   ```
   
   and upgrading `axios-cookiejar-support` to `@2.04` solved it (but I'm not using cookies with CouchDB, just basic auth - this would cause other issues, as mentioned [here](https://github.com/apache/couchdb-nano/pull/294))


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] LyteFM commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
LyteFM commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-1077371049


   With current versions of NestJS, `@nestjs/axios` and `axios-cookiejar-support`, I ran into the issue again. Replacing
   
   ```
    const axiosCookieJarSupport = require('axios-cookiejar-support').default
   ```
   
   with
   
   ```
   const axiosCookieJarSupport = require('axios-cookiejar-support').wrapper
   ```
   
   solved it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] glynnbird commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
glynnbird commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-976365189


   This is a peculiar one. Must be something to do with whatever webpack does to Nano on its journey to client-side JavaScript. Does anyone have any suggestions as to what Nano can do to stop this happening? As @LyteFM states, the package works fine in "normal" circumstances.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989056083


   This error doesn't happen under "normal" circumstances as @glynnbird mentioned. However, if you are using a framework like Next.js, this error will appear if you **don't** place `const nano = require('nano')('http://localhost:5984');` under `getStaticProps` or `getServerSideProps`. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989056083


   This error doesn't happen under "normal" circumstances as @glynnbird mentioned. However, if you are using a framework like Next.js, this error will appear if you **don't** place `const nano = require('nano')('http://localhost:5984');` under `getStaticProps` or `getStaticPaths`. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mannyquick12 commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mannyquick12 commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-894885289


   I get this too... Anything related to webpack?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] mariothedev edited a comment on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
mariothedev edited a comment on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-989056083


   Has anybody been able to figure this out? I am currently following the Typescript example in the documentation and the problem still persists. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] kwesimanny commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
kwesimanny commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-968963620


   > I get the same error. I try to connect to the database like it says in your documentation: `const nano = require('nano')('http://localhost:5984')` but get the error mentioned above.
   > 
   > ![image](https://user-images.githubusercontent.com/2650171/117926250-c57eff00-b2f8-11eb-9544-1cf4772bf7b4.png)
   
   I was able to fix my by removing the .default for axios-cookiejar-support.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-nano] glynnbird commented on issue #264: Uncaught TypeError: axiosCookieJarSupport is not a function

Posted by GitBox <gi...@apache.org>.
glynnbird commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-911520913


   Couldn't reproduce myself:
   
   ```js
   const nano = require('nano')({
     url: process.env.COUCH_URL,
     requestDefaults: {
       jar: true
     }
   })
   const username = 'myusername'
   const userpass = 'mypassword'
   const db = nano.db.use('people')
   
   const main = async () => {
     // authenticate
     await nano.auth(username, userpass)
     const r = await db.list({ limit: 5 })
     console.log(r)
   }
   
   main()
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org