rereradu
rereradu

Reputation: 334

Meteor Legacy bundle served when using Headless Chrome (with puppeteer) on Debian 10

I am using Meteor 1.10.2 on Debian 10 Buster. When loading the site in Headless Chrome (using puppeteer), the web.legacy bundle is used, which is causing lots of errors - my app doesn't support legacy browsers.

Example of error captured in the console:

no such file or directory, open '<PATH_TO_APPLICATION>/bundle/programs/web.browser.legacy/dynamic/node_modules/@babel/runtime/helpers/toConsumableArray.js'

The user agent is set to Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/83.0.4103.116 Safari/537.36 by default.

Is there any other feature detection that determines which bundle to use? What's causing the app to serve the legacy bundle in this situation?

UPDATE

Eventually I found the culprit (tldr: not a Meteor issue). Here's the explanation: I was trying to create a pre-rendered version of the page to serve to crawlers / search engines but I failed to prevent client re-hydration and that's what was actually causing the errors. The solution was to first test if the app has already been pre-rendered server side before calling the client-side code (in my case just checking if the document body had a specific element as its child).

Upvotes: 1

Views: 215

Answers (1)

Jankapunkt
Jankapunkt

Reputation: 8423

Fortunately this has been fixed with a PR in Meteor 1.10.1, that allows you to omit the legacy bundle explicitly on a build or test run.

You can simply use the --exclude-archs parameter like to:

$ meteor test --exclude-archs web.browser.legacy

Related: https://github.com/meteor/meteor/blob/devel/History.md#v1101-2020-03-12

If you want to know more about the background on web.browser.legacy you can review these two resources:

https://github.com/meteor/meteor/blob/devel/History.md#v17-2018-05-28

https://blog.meteor.com/meteor-1-7-and-the-evergreen-dream-a8c1270b0901

Upvotes: 0

Related Questions