ERR_BLOCKED_BY_ORB with puppeteer – Puppeteer

by
Alexei Petrov
cors node.js pullrequest puppeteer

The Problem:

While working on an Express JS API to convert base64 HTML to PDF, the developer faces an issue involving loading an image from a third-party server using Puppeteer. When trying to retrieve the image, errors related to "ERR_BLOCKED_BY_ORB" occur in Chromium with "headless: false" mode. Despite having the cookie present in Chromium, the developer continues to encounter this issue. Additionally, when loading Google fonts, CORS policy issues arise. The developer has attempted various solutions, including adding Helmet, disabling web security, and using "crossorigin=anonymous" in the HTML code, but none of these approaches have resolved the problem.

The Solutions:

Solution 1: Verify the API response type

To resolve the ERR_BLOCKED_BY_ORB error, verify the response type of the API call. Ensure that the response is in the expected format, such as a JavaScript file. If the response is not in the correct format, the call will be blocked by the ORB (Origin-Bound Restrictions) security mechanism.

To debug the issue, open the API call in a separate window to view the actual response. This will help you determine if the response is what you expect and identify any discrepancies.

Q&A

What is the solution to ERR_BLOCKED_BY_ORB with puppeteer?

Ensure that the server’s response matches the expected JavaScript file.

What should be checked in case of ERR_BLOCKED_BY_ORB?

Confirm that the server’s response is the anticipated JavaScript file.