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.

Hi, It’s seems there’s a problem with request( version 2.67) with tough-cookie 2.2.1

TypeError: Cannot read property 'secure' of undefined
    at CookieJar.getCookies (/home/guillaume/Bureau/optionizor/node_modules/tough-cookie/lib/cookie.js:1031:23)
    at CookieJar.getCookieString (/home/guillaume/Bureau/optionizor/node_modules/tough-cookie/lib/cookie.js:1132:19)
    at Request.jar (/home/guillaume/Bureau/optionizor/node_modules/request/request.js:1302:33)
    at Request.init (/home/guillaume/Bureau/optionizor/node_modules/request/request.js:313:8)

cf :

var t = require("tough-cookie");
var jar = new t.CookieJar();

request.post({
        url:searchaction,
        body:bodystr,
        headers:{
                "Content-Type": "application/x-www-form-urlencoded",
                "User-agent":agent,
                "Referer":referer
        },
        jar: jar
    }, function(error, response, body){

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
cspotcodecommented, Feb 21, 2018

Request uses a wrapper around tough-cookie’s jar implementation. Here’s my workaround to get full access to tough-cookie’s API.

const jar = request.jar();
const toughCookieJar = jar._jar;

// or if I must create the jar myself, perhaps to pass additional options...
// Note that request enables looseMode on the internal jar.  You probably need to do this as well; I haven't tested.
const toughCookieJar = new toughCookie.CookieJar(undefined, {looseMode: true});
const jar = request.jar();
jar._jar = toughCookieJar;
3reactions
simovcommented, Dec 10, 2015

Did you tried with var jar = request.jar()? Request depends on tough-cookie internally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

http.cookiejar — Cookie handling for HTTP clients — Python ...
The http.cookiejar module defines classes for automatic handling of HTTP cookies. It is useful for accessing web sites that require small pieces of...
Read more >
cookiejar - npm
simple persistent cookiejar system. Latest version: 2.1.3, last published: a year ago. Start using cookiejar in your project by running `npm ...
Read more >
Cookie Jars / Food Storage: Home & Kitchen - Amazon.com
OXO Good Grips 3.0 Qt POP Medium Cookie Jar - Airtight Food Storage - for Snacks and More ... No matter what you...
Read more >
Cookie Jars - Target
Mickey Mouse and Friends 15oz Ceramic Holiday Cookie Jar ... JoyFul Round Glass Cookie Jar with Airtight Lids - 67 oz Kitchen Containers...
Read more >
net/http/cookiejar - Go Packages
Cookies implements the Cookies method of the http.CookieJar interface. It returns an empty slice if the URL's scheme is not HTTP or HTTPS....
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