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.

Puppeteer adapter: "Evaluation failed: TypeError: Failed to fetch"

See original GitHub issue

I’m attempting to use Polly in an existing project to test a webform, however upon adding Polly with the Puppeteer adapter I’m running into this error from Puppeteer.

Evaluation failed: TypeError: Failed to fetch

This error isn’t present without Polly and the Puppeteer adapter.

I can provide more details upon request, but I’m unsure on what I need to share to diagnose this issue right now.

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

4reactions
scotthovestadtcommented, Apr 9, 2019

FYI this happens because of CSP errors and can be resolved with:

await page.setBypassCSP(true);
1reaction
scotthovestadtcommented, Apr 9, 2019

An easy way to reproduce it is to just open the console on github.com (this page works fine) and enter:

fetch('https://github.githubassets.com/favicon.ico')
Screen Shot 2019-04-09 at 12 41 02 AM

This shows in the console as:

Evaluation failed: TypeError: Failed to fetch

      at anonymous (__puppeteer_evaluation_script__:3:8)
      at ExecutionContext.evaluateHandle (node_modules/puppeteer/lib/ExecutionContext.js:122:13)
      ...

It’s triggered by the following header:

Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com

I’ll look into setting up a fail test, but regardless is probably a good idea to just recommend that the user turn this on in the documentation or even in the error message for fetch failing. I’m not seeing an easier way to work around it (unless you want to turn it on for them).

Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer is failing to upload a file with TypeError
@blex Just tried this, but I'm still getting the Evaluation failed: TypeError: Failed to fetch error. – Sup3r D. Mar 22, 2020 at...
Read more >
@pollyjs/adapter-puppeteer - npm
Record, Replay, and Stub HTTP Interactions ... The @pollyjs/adapter-puppeteer package provides a Puppeteer adapter to be used with @pollyjs/core .
Read more >
failed to fetch dynamically imported module - You.com | The AI ...
Describe the bug. I am encountering some issues when deploying my project to vercel using the vercel-adapter. The project builds but then the...
Read more >
consistent bad gateway using npm artifacts
When trying to restore the following package from my azure artifact, it fails with bad gateway. https://www.npmjs.com/package/jsnlog.
Read more >
The Tidelift catalog of open source packages
Fetch all the members of all the specified github organizations with their complete details ... Custom error messages in JSON-Schema for Ajv validator....
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