GoogleChromeLabs / GoogleChromeLabs/bubblewrap

Init command fails when fetching webmanifest

Open
#787 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

When running:
`bubblewrap init --manifest ` (I have tried several different ones)

The command fails when this line runs:
https://github.com/GoogleChromeLabs/bubblewrap/blob/ebd402d54dff5a5c274870db961f2f32455eb4b6/packages/core/src/lib/TwaGenerator.ts#LL269C32-L269C32

The error is `ERR_HTTP2_INVALID_SESSION` and seems to be related to incompatibility with either OS (macOS Ventura 13.2.1) or Node environment (Using https://volta.sh, tried Node 19.8.1, 18.16.0 and 14.15.5).

Call Stack
```bash
doFetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/fetch-http2.js:58)
await (Unknown Source:0)
handleSignalAndTimeout (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/fetch-common.js:176)
fetchImpl (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/fetch-http2.js:198)
await (Unknown Source:0)
fetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/fetch-http2.js:207)
doFetchHttp2 (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:143)
connectSequenciallyTLS (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:216)
(/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:200)
(/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/already/dist/index.js:531)
Try (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/already/dist/index.js:337)
runner (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/already/dist/index.js:531)
(/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/already/dist/index.js:534)
retryableFetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:198)
retryFetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:100)
fetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/fetch-h2/dist/lib/context.js:81)
fetch (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/@bubblewrap/core/dist/lib/FetchUtils.js:38)
writeWebManifest (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/@bubblewrap/core/dist/lib/TwaGenerator.js:219)
createTwaProject (/Users/home/.volta/tools/image/packages/@bubblewrap/cli/lib/node_modules/@bubblewrap/cli/node_modules/@bubblewrap/core/dist/lib/TwaGenerator.js:350)
```

When replacing the fetchutil with built-in fetch (node 18 or higher) the `init` command works without issue and the webmanifest is fetched.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a fresh directory in macOS Ventura using a node package manager with any Node version 14.15+.
2. Run `bubblewrap init --manifest `, install dependencies and follow the steps.
3. The CLI should error at 55% citing `cli ERROR The session has been destroyed`.

**Expected behavior**

`init` command should finish without unexpected errors like the above, especially errors related to node/OS environment.

**Desktop (please complete the following information):**
- OS: macOS Ventura 13.2.1
- Browser N/A
- Version N/A

**Additional context**

Related to this comment, though the issue this comment exists in seems to be unrelated (the directory where the command is run does not improve on the outcome): https://github.com/GoogleChromeLabs/bubblewrap/issues/701#issuecomment-1187636830

Review the fetch utilities used by Bubblewrap. Consider using native fetch in Node 18+

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.