stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.07k stars 392 forks source link

YouTube Video Embed Causing Error: DOMEXception: A network error occured. #560

Open oosharma opened 2 years ago

oosharma commented 2 years ago

Bug Report

Current Behavior When an iframe for Youtube is embeded, I get this error when I try to run 'yarn build' - DOMEXception: A network error occured.

Reproducible demo https://codesandbox.io/s/jolly-tess-2d2koq?file=/src/App.js:78-79

Expected behavior/code The build command should run without throwing this error

xgschwi commented 2 years ago

@oosharma I got the same error with my project that has a youtube link embedded in an iframe. I dug around the react-snap library and I traced the issue down to the inlineCss option.

const minimalcssResult = await minimalcss.minimize({
    urls: [pageUrl],
    skippable: request =>
      options.skipThirdPartyRequests && !request.url().startsWith(basePath),
    browser: browser,
    userAgent: options.userAgent
  });

While I had inlineCss set to true, I put a try catch around the minimalcss.minimize function and that caused the error to throw. As of now, I could not find any way around it besides setting my inlineCss option to false in my package.json:

"reactSnap": {
    "inlineCss": false,
    "source": "./dist",
    "puppeteerArgs": [
      "--no-sandbox",
      "--disable-setuid-sandbox"
    ],
    "puppeteerExecutablePath": "/opt/google/chrome/google-chrome"
  },

image