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

har.stop() - random error - "RangeError: Invalid time value" #61

Open
amezioud opened this issue Feb 24, 2020 · 3 comments
Open

har.stop() - random error - "RangeError: Invalid time value" #61

amezioud opened this issue Feb 24, 2020 · 3 comments

Comments

@amezioud
Copy link

amezioud commented Feb 24, 2020

My netsniffPrototype.js :

await this.page.goto(url, {timeout: 60000});
let cssSelectorconsent = '#consent-notice-agree-button';
let cookieAcceptBtn = await this.page.waitForSelector(cssSelectorconsent, { timeout: 60000, visible: true });
await cookieAcceptBtn.click();
await this.page.setCacheEnabled(false);
await this.harStart();
await this.page.reload({waituntil: networkidle2, timeout: 60000});
await this.harStop();

Add console.log in chrome-har/lib/entryFromResponse.js

  const entrySecs =
    page.__wallTime + (timing.requestTime - page.__timestamp);
  console.log('page.__wallTime  = ' + page.__wallTime + ' timing.requestTime =  ' + timing.requestTime + ' page.__timestamp  = ' + page.__timestamp)
  entry.startedDateTime = dayjs.unix(entrySecs).toISOString();
  console.log('dayjs.unix(entrySecs).toISOString() =  ' + dayjs.unix(entrySecs).toISOString())

Stdout results (Python call nodejs script using subprocess.run() ) :

2020-02-24:12:39:28,092 INFO [netsniffPrototype.js:296] <Thread(Thread-1, started daemon 140015018862336)> Stop Har events

page.__wallTime = 1582544363.28644
timing.requestTime = 6971.141358
page.__timestamp 6971.138063
dayjs.unix(entrySecs).toISOString() = 2020-02-24T11:39:23.289Z

page.__wallTime = undefined
timing.requestTime = 6971.149286
page.__timestamp = undefined

2020-02-24:12:39:28,101 ERROR [netsniffPrototype.js:303] <Thread(Thread-1, started daemon 140015018862336)> Process exitHarNotStopped event Har not stopped properly !
e.stack => RangeError: Invalid time value
at Date.toISOString ()
at h.d.toISOString (/home/pptruser/node_modules/dayjs/dayjs.min.js:1:6372)
at module.exports (/home/pptruser/node_modules/chrome-har/lib/entryFromResponse.js:161:53)
at harFromMessages (/home/pptruser/node_modules/chrome-har/index.js:310:15)
at PuppeteerHar.stop (/home/pptruser/node_modules/puppeteer-har/lib/PuppeteerHar.js:109:21)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)

@soulgalore
Copy link
Member

It looks like something is broken upstream or can you show me what's not working in Chrome-har? I don't follow.

@amezioud
Copy link
Author

what could have happened upstream?

@amezioud
Copy link
Author

If I start the har capture without reloading, it works everytime without issue.

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