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

How to use the --cookie parameter? // Error: Protocol error (Network.setCookies): Invalid parameters cookies.0.expires: double value expected #21

Closed
ewasser opened this issue Jan 2, 2020 · 2 comments

Comments

@ewasser
Copy link

ewasser commented Jan 2, 2020

Hello *,

how can I use the --cookie parameter? The examples section says --cookie="id=unicorn; Expires=Wed, 21 Oct 2018 07:28:00 GMT;".

Putting this into a CLI command will not work. Here's an example:

$ ~/node_modules/capture-website-cli/cli.js https://www.google.de --cookie="CONSENT=YES+DE.en+V9; Expires=Sat, 09 Jan 2038 07:28:00 GMT;" --output=test.png
^CError: Protocol error (Network.setCookies): Invalid parameters cookies.0.expires: double value expected
    at Promise (/home/knipser/node_modules/capture-website-cli/node_modules/puppeteer/lib/Connection.js:183:56)
    at new Promise (<anonymous>)
    at CDPSession.send (/home/knipser/node_modules/capture-website-cli/node_modules/puppeteer/lib/Connection.js:182:12)
    at Page.setCookie (/home/knipser/node_modules/capture-website-cli/node_modules/puppeteer/lib/Page.js:416:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Page.<anonymous> (/home/knipser/node_modules/capture-website-cli/node_modules/puppeteer/lib/helper.js:111:15)
    at captureWebsite (/home/knipser/node_modules/capture-website-cli/node_modules/capture-website/index.js:213:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)

After the CLI was entered the process hangs until I press CTRL-c (you can see the ^C in the output) and then the error messages appears.

Shouldn't the --cookie parameter be parsed so the underlying library got some dictionary instead of a simple string? In the cli.js the parameter will be just arrifyed.

@sindresorhus
Copy link
Owner

This is fixed now: https://github.com/sindresorhus/capture-website/releases/tag/v0.8.1

Just reinstall the CLI to get the fix.

@ewasser
Copy link
Author

ewasser commented Jan 2, 2020

That was awesome and fast. And it's working. Thank you!

sgtrusty added a commit to sgtrusty/capture-website that referenced this issue Apr 12, 2020
* Fix setting an expiring cookie

Fixes sindresorhus/capture-website-cli#21

* 0.8.1

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
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