Skip to content

chore: read browsers.json with require#6186

Merged
mxschmitt merged 1 commit into
microsoft:masterfrom
mxschmitt:bugfix/vercel
Apr 19, 2021
Merged

chore: read browsers.json with require#6186
mxschmitt merged 1 commit into
microsoft:masterfrom
mxschmitt:bugfix/vercel

Conversation

@mxschmitt

@mxschmitt mxschmitt commented Apr 12, 2021

Copy link
Copy Markdown
Contributor

This fixes the compatibility on Vercel with Next.js when it's used in
a serverless function.
Next.js uses https://github.com/vercel/nft to trace down the
dependencies which a serverless function is using which
is currently not capable of detecting the browsers.json in our current
setup. Previously we used require to load the browers.json which was
replaced by readFileSync in #5318. Since then it was broken.

require has not much down-sides except its caching which in our-case
should not have any side-effects.

Without that it caused a Error: ENOENT: no such file or directory, open '/var/task/node_modules/playwright-core/browsers.json'.

Fixes #5862

@mxschmitt mxschmitt changed the title chore: read browser.json with require chore: read browsers.json with require Apr 12, 2021
This fixes the compatibility on Vercel with Next.js when it's used in
a serverless function.
Next.js uses https://github.com/vercel/nft to trace down the
dependencies which a serverless function is using which
is currently not capable of detecting the browsers.json in our current
setup. Previously we used require to load the browers.json which was
replaced by readFileSync in microsoft#5318. Since then it was broken.

Fixes microsoft#5862
Comment thread src/utils/registry.ts
@mxschmitt mxschmitt requested a review from aslushnikov April 19, 2021 17:33
@mxschmitt mxschmitt merged commit 7ec57c0 into microsoft:master Apr 19, 2021
@juice49

juice49 commented May 22, 2021

Copy link
Copy Markdown

Unfortunately, this fix no longer works. It seems like bigger changes would need to be made in order for the browsers.json file to be included in the files traced by NFT.

One of the NFT maintainers has provided more info about this at vercel/nft#211.

@mxschmitt

Copy link
Copy Markdown
Contributor Author

@yizhiyan

Copy link
Copy Markdown

Try to set the interface for playwright with electron, but the prompt after introduction fails to find browsers.json

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

Successfully merging this pull request may close these issues.

[BUG] Error: ENOENT: no such file or directory, open '/var/task/node_modules/playwright-core/browsers.json' on Vercel with Next.js

5 participants