Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite Bundle Error for new Astro Actions in Astro v4.8 (cannot bundle node:async_hooks) #11005

Closed
1 task
rhymbit opened this issue May 10, 2024 · 32 comments
Closed
1 task
Assignees
Labels
- P2: has workaround Bug, but has workaround (priority)

Comments

@rhymbit
Copy link

rhymbit commented May 10, 2024

Astro Info

Astro                    v4.8.2
Node                     v20.11.1
System                   Linux (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I created a astro starter project repo that shows this problem. Please checkout the README, also clone and try to build the project.
https://github.com/rhymbit/astro-actions-bundle-bug

Vite is unable to bundle node:async_hooks module which is used in a file (store.js) by the new "Astro Actions" feature.
I'm using pnpm and this is the file that uses it :-
node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/actions/runtime/store.js

What's the expected result?

Expected result will be that pnpm build builds the project successfully.
There were 0 errors with astro check, but the build still fails becasuse vite cannot bundle this node:async_hooks module.

Link to Minimal Reproducible Example

https://github.com/rhymbit/astro-actions-bundle-bug

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label May 10, 2024
@bholmesdev
Copy link
Contributor

Hey @rhymbit! I see you're using the Cloudflare adapter here. You'll need to add the nodejs_compat compatibility flag to use actions. We use the 'async local storage' feature to help you access API context (headers, cookies, etc) from your actions. Is this possible, or will this have drawbacks for you?

@bholmesdev bholmesdev self-assigned this May 10, 2024
@bholmesdev bholmesdev added - P2: has workaround Bug, but has workaround (priority) and removed needs triage Issue needs to be triaged labels May 10, 2024
@rhymbit
Copy link
Author

rhymbit commented May 11, 2024

@bholmesdev
I added the wrangler.toml file in the root of my project and also updated the astro.config.mjs to include it :-

  adapter: cloudflare({
    platformProxy: {
      enabled: true,
      configPath: "wrangler.toml",
    },
  }),

I've also pushed these changes to the project's repository so you can check them out.

But it still fails to build with the exact same error.

Is it not possible for me to build this project locally on my PC, and will it only build inside the Cloudflare dashboard?
I haven't tested this for my original project, because I'm not using Cloudflare's CI-CD, and rather I'm building the project locally and uploading assets using wrangler-cli. But since it doesn't even finish building, unfortunately I can't upload anything 🤷🏻‍♂️.

Please let me know if there's any other way to build a project locally that uses Actions in it, but for now I suppose I'll just simply use endpoints.

@bholmesdev
Copy link
Contributor

Ah yep, looks like we missed one more step: you'll need to mark the node dependency as "external" in your astro config. The @astrojs/cloudflare docs point out how to do this: https://docs.astro.build/en/guides/integrations-guide/cloudflare/#nodejs-compatibility

Let me know if that resolves the issue!

@rhymbit
Copy link
Author

rhymbit commented May 11, 2024

@bholmesdev
Yup, now it works perfectly without any problems.
Thanks a lot for your help ❤️
I've pushed the working code to the repo and I also updated the README with fix details.
(Fixed) -> https://github.com/rhymbit/astro-actions-bundle-bug

@rhymbit rhymbit closed this as completed May 11, 2024
chiubaca added a commit to chiubaca/fullstack-astro-cloudflare that referenced this issue May 12, 2024
@chiubaca
Copy link

chiubaca commented May 12, 2024

I'm running into the same issue. I've tried copying @rhymbit astro config and wrangler.toml files like-for-like but I keep getting build errors on cloudflare:

05:15:53.449 | Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:async_hooks".   imported from "renderers.mjs"

heres my repo : https://github.com/chiubaca/fullstack-astro-cloudflare

@bholmesdev
Copy link
Contributor

Hey @chiubaca! Sorry to hear that. Taking a peak at the source code, it looks like your astro.config.mjs is configured correctly, but you're missing the nodejs_compat flag in your wrangler.toml:

compatibility_flags = [ "nodejs_compat" ]

Have you tried setting this?

@chiubaca
Copy link

Thanks for the response @bholmesdev . The issues was indeed my wrangler.toml.

These settings are have fixed the issue for me

name = "fullstack-astro-cloudflare"
compatibility_flags = ["nodejs_als"]
compatibility_date = "2024-05-12"
pages_build_output_dir = "dist"

@bhargawananbhuyan
Copy link

Hey @bholmesdev, I came here from your Astro Actions YouTube video, I tried to mimic it, but I'm getting error in preview using @astrojs/cloudflare adapter.

✘ [ERROR] service core:user:blog: Uncaught ReferenceError: MessageChannel is not defined

    at null.<anonymous> (tqx49h9p2ob.js:11320:5) in
  .wrangler/tmp/pages-A87Vez/chunks/_@astro-renderers_CCtvfKAP.mjs
    at null.<anonymous> (tqx49h9p2ob.js:4:56) in __init
    at null.<anonymous> (tqx49h9p2ob.js:16323:1)


✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.

I tried doing everything told above --

name = "blog"
compatibility_date = "2024-07-12"
pages_build_output_dir = "./dist"
compatibility_flags = ["nodejs_compat"]

@bholmesdev
Copy link
Contributor

Hey @bhargawananbhuyan! Got it. Workers can be finicky. It looks like that error is coming from an Astro renderer rather than actions, but I can't be sure. Did you also try adding node:async_hooks to the vite.ssr.external config?

@clayton-schneider
Copy link

Hey @bholmesdev, I followed these instructions which fixed the first error but now I am running into a different error:
Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:async_hooks". imported from "chunks/shared_DroBbxOq.mjs"

@bholmesdev
Copy link
Contributor

@clayton-schneider Got it. Did you also apply the NoeJS compat flag as noted here?

Seems like it's easy to see my comment on the first bit, and miss my comment on the second 😅 My mistake! For anyone that finds this issue, it can be resolved in two steps:

  1. Add the nodejs_compat flag to your wrangler.toml file (or the nodejs_als flag) as described on the Cloudflare docs.
  2. Add node:async_hooks to your vite.ssr.external configuration

@yocheco
Copy link

yocheco commented Jul 25, 2024

Hey @bholmesdev, I followed these instructions which fixed the first error but now I am running into a different error: Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:async_hooks". imported from "chunks/shared_DroBbxOq.mjs"

In https://dash.cloudflare.com/ go to Workers & Pages > click in Worker > TAP Settings
in lateral menu select Functions in Compatibility flags add "nodejs_compat"

image

@wireless25
Copy link

@bholmesdev we run into the same error, but with the Netlify adapter. Netlify functions run in a node environment, right? Any suggestions?

@bholmesdev
Copy link
Contributor

@wireless25 oh hm, yes they should run in a node environment. Are you using Netlify edge functions maybe? Paste the error log here if there's anything unique we can use.

@wireless25
Copy link

thx for your fast reply @bholmesdev

Following the relevant error log from the Netlify build. The issue appeared when we started using server actions.

4:24:24 PM: apps/www build: ✘ [ERROR] Could not resolve "node:async_hooks"
4:24:24 PM: apps/www build:     .netlify/functions-internal/ssr/chunks/shared_CVtVv-q0.mjs:1:34:
4:24:24 PM: apps/www build:       1 │ import { AsyncLocalStorage } from 'node:async_hooks';
4:24:24 PM: apps/www build:         ╵                                   ~~~~~~~~~~~~~~~~~~
4:24:24 PM: apps/www build:   The package "node:async_hooks" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
apps/www build: Could not resolve "node:async_hooks"
4:24:24 PM: apps/www build:   Stack trace:
4:24:24 PM: apps/www build:     at failureErrorWithLog (/opt/build/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1651:15)
4:24:24 PM: apps/www build:     at /opt/build/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1004:52
4:24:24 PM: apps/www build:     at /opt/build/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1086:16
4:24:24 PM: apps/www build:     at handleIncomingPacket (/opt/build/repo/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:764:9)
4:24:24 PM: apps/www build:     at Socket.emit (node:events:519:28)
4:24:24 PM: apps/www build: Failed
4:24:24 PM: /opt/build/repo/apps/www:
4:24:24 PM:  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @sozialinfo/[email protected] build: `astro build`
4:24:24 PM: Exit status 1

Now as you say it, we do use the "edgeMiddleware" feature of the Netlify adapter. Could it be conflicting with server actions?

export default defineConfig({
  // ...
  adapter: netlify({
    cacheOnDemandPages: false,
    edgeMiddleware: true,
  }),
  // ...
})

@bholmesdev
Copy link
Contributor

@wireless25 ah ha, that could be the issue as well. Actions use middleware to handle result data, and I bet Netlify does not use Node by default. The runtime error seems to recommend using "platform: 'node'" to remove this error. I'm unfamiliar with this Netlify option, but is that either a) an adapter option, or b) an option from the Netlify console?

@wireless25
Copy link

wireless25 commented Jul 28, 2024

Ok, when middleware is used for actions, it could be the problem. I disabled edgeMiddleware in Netlify's adapter options

// astro.config.ts
export default defineConfig({
  // ...
  adapter: netlify({
    edgeMiddleware: false,
  }),
  // ...
})

The build went through now. So it has something to do with the Edge functions as middleware.

I can not understand that though, in the docs they clearly point out, that node internals can be imported directly by using the node: prefix. As we saw above in the error message, the node prefix seems to be used correctly, so no idea why this module is not available. Is there a specific Node version needed to use AsyncLocalStorage?

For now, this workaround is fine, maybe it would help to have a hint in the Astro docs or the adapter docs?

@bholmesdev
Copy link
Contributor

@wireless25 Ah ha, digging deeper on that error log, it sounds like our esbuild bundler is raising the issue. I see we're setting platform: "neutral" when bundling the middleware. I wonder if we can set platform: "node" safely... I'll check with the core team

@bholmesdev
Copy link
Contributor

bholmesdev commented Jul 30, 2024

@wireless25 Update: looks like this was fixed in the latest Netlify package! Can you try installing @astrojs/netlify@latest?

Actually, I've spoken too soon. The project does build now, but it will fail in production if you attempt to use a server fallback for actions. The reason is a bit complicated: we use async local storage to keep track of an action result. If you deploy middleware to the edge, it will live in a different context from the page itself. So we can no longer pass that result to your page.

We'd need to rearchitect how Actions work to support edge middleware. I'm not certain what that would look like. But for now, I would recommend disabling the edge middleware option. Is there a reason this could be a problem for your application?

@bholmesdev
Copy link
Contributor

Update: fix is in PR! We've removed async local storage from the pipeline, and we've serialized action results to travel over-the-wire from edge middleware to your application. You can track the fix here

@wireless25
Copy link

@bholmesdev thank you so much for digging deeper into this and already working on the solution. Just found #11602 which will bring these fixes to Astro. Is there any plan for when this will be released?

@bholmesdev
Copy link
Contributor

@wireless25 Thanks for the reminder! We just merged the latest patches. Expect these to land in the next hour or so.

@innocces
Copy link

still error. my repo url

Error: Failed to publish your Function. Got error: Uncaught ReferenceError: MessageChannel is not defined
  at chunks/_@astro-renderers_1kpNbmKW.mjs:6483:15

already addon:

ssr: {
      external: ['node:buffer', 'node:worker_threads', 'node:async_hooks']
    },

setting function with: nodejs_compat
image

@bholmesdev
Copy link
Contributor

Hey @innocces! Hm, we no longer require the nodejs_compat flag after we removed async local storage from our internals. The MessageChannel error is new to me. Would you be able to share a minimal reproduction to ensure other packages aren't causing the issue?

@innocces
Copy link

innocces commented Aug 17, 2024

Hey @innocces! Hm, we no longer require the nodejs_compat flag after we removed async local storage from our internals. The MessageChannel error is new to me. Would you be able to share a minimal reproduction to ensure other packages aren't causing the issue?

#11005 (comment)

here is same problem!!!

#11005 (comment)

the resolve you provide is add node:xxx mode to ssr config

@innocces
Copy link

Hey @innocces! Hm, we no longer require the nodejs_compat flag after we removed async local storage from our internals. The MessageChannel error is new to me. Would you be able to share a minimal reproduction to ensure other packages aren't causing the issue?

I found the reason. It's because I'm using react@beta, version 19. The astro-renderer packaged in the worker contains part of the MessageChannel code that the client can only execute. When I switched to version 18, everything went back to normal.

email-reciever/website@703de4b#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

@kunjee17
Copy link

I a facing similar issue here. https://github.com/kunjee17/anala . I have added firebase admin and it just don't compile with edgeFunction:true in netlify. Any help possible?

@bholmesdev
Copy link
Contributor

Hey @kunjee17! Sorry you're hitting issues with edge functions. I know Netlify uses the Deno runtime for that, which isn't always Node compliant. Mind sharing the error you see at runtime?

@kunjee17
Copy link

@bholmesdev thanks for reply.

Here is error message

 Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/app/lifecycle.js:21:19:
      21 │ const fs = require("fs");
         ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/app/credential-internal.js:21:19:
      21 │ const fs = require("fs");
         ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/validator.js:21:20:
      21 │ const url = require("url");
         ╵                     ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/validate.js:32:22:
      32 │ const url_1 = require("url");
         ╵                       ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "os"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/app/credential-internal.js:22:19:
      22 │ const os = require("os");
         ╵                    ~~~~

  The package "os" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/util.js:35:25:
      35 │ const crypto_1 = require("crypto");
         ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/index.js:19:25:
      19 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/crypto-signer.js:49:31:
      49 │         const crypto = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
         ╵                                ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/app/credential-internal.js:23:21:
      23 │ const path = require("path");
         ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/index.js:20:22:
      20 │ const url_1 = require("url");
         ╵                       ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "http"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:23:21:
      23 │ const http = require("http");
         ╵                      ~~~~~~

  The package "http" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "https"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:24:22:
      24 │ const https = require("https");
         ╵                       ~~~~~~~

  The package "https" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/sign.js:12:65:
      12 │ const { KeyObject, createSecretKey, createPrivateKey } = require('crypto')
         ╵                                                                  ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "http2"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:25:22:
      25 │ const http2 = require("http2");
         ╵                       ~~~~~~~

  The package "http2" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/jws/lib/sign-stream.js:5:21:
      5 │ var Stream = require('stream');
        ╵                      ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:26:20:
      26 │ const url = require("url");
         ╵                     ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/node-forge/lib/prng.js:18:20:
      18 │   _crypto = require('crypto');
         ╵                     ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/jws/lib/verify-stream.js:5:21:
      5 │ var Stream = require('stream');
        ╵                      ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "tty"

    node_modules/.pnpm/[email protected]/node_modules/debug/src/node.js:5:20:
      5 │ const tty = require('tty');
        ╵                     ~~~~~

  The package "tty" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jsonwebtoken/verify.js:9:62:
      9 │ const {KeyObject, createSecretKey, createPublicKey} = require("crypto");
        ╵                                                               ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:27:25:
      27 │ const events_1 = require("events");
         ╵                          ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/node-forge/lib/pbkdf2.js:19:19:
      19 │   crypto = require('crypto');
         ╵                    ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/sign.js:3:23:
      3 │ const crypto = require("crypto");
        ╵                        ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "http"

    node_modules/.pnpm/[email protected]/node_modules/jwks-rsa/src/wrappers/request.js:1:21:
      1 │ const http = require('http');
        ╵                      ~~~~~~

  The package "http" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "http"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js:3:21:
      3 │ const http = require("http");
        ╵                      ~~~~~~

  The package "http" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/decrypt.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/generate.js:4:25:
      4 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jwa/index.js:3:21:
      3 │ var crypto = require('crypto');
        ╵                      ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/jws/lib/data-stream.js:3:21:
      3 │ var Stream = require('stream');
        ╵                      ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "zlib"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/zlib.js:5:23:
      5 │ const zlib_1 = require("zlib");
        │                        ~~~~~~
        ╵                        "./zlib"

  The package "zlib" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/lru-memoizer/lib/async.js:39:23:
      39 │ var events_1 = require("events");
         ╵                        ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/digest.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "zlib"

    node_modules/.pnpm/[email protected]/node_modules/firebase-admin/lib/utils/api-request.js:555:33:
      555 │             const zlib = require('zlib'); // eslint-disable-line @typescript-eslint/no-var-requires
          ╵                                  ~~~~~~

  The package "zlib" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "https"

    node_modules/.pnpm/[email protected]/node_modules/jwks-rsa/src/wrappers/request.js:2:22:
      2 │ const https = require('https');
        ╵                       ~~~~~~~

  The package "https" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "https"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js:4:22:
      4 │ const https = require("https");
        ╵                       ~~~~~~~

  The package "https" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/random.js:4:23:
      4 │ var crypto_1 = require("crypto");
        ╵                        ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/asn1.js:4:25:
      4 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/webcrypto.js:4:23:
      4 │ const crypto = require("crypto");
        ╵                        ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "os"

    node_modules/.pnpm/[email protected]/node_modules/supports-color/index.js:2:19:
      2 │ const os = require('os');
        ╵                    ~~~~

  The package "os" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/is_key_object.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/[email protected]/node_modules/jwks-rsa/src/wrappers/request.js:3:24:
      3 │ const urlUtil = require('url');
        ╵                         ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js:4:25:
      4 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/encrypt.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js:5:25:
      5 │ const events_1 = require("events");
        ╵                          ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/node_key.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/node-forge/lib/rsa.js:77:44:
      77 │ var _crypto = forge.util.isNodejs ? require('crypto') : null;
         ╵                                             ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/lru-memoizer/lib/sync.js:28:23:
      28 │ var events_1 = require("events");
         ╵                        ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/object-hash/index.js:3:21:
      3 │ var crypto = require('crypto');
        ╵                      ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "querystring"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/routingHeader.js:19:28:
      19 │ const querystring = require("querystring");
         ╵                             ~~~~~~~~~~~~~

  The package "querystring" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/longRunningCalls/longrunning.js:20:25:
      20 │ const events_1 = require("events");
         ╵                          ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/verify.js:3:23:
      3 │ const crypto = require("crypto");
        ╵                        ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/paginationCalls/pageDescriptor.js:19:25:
      19 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js:5:25:
      5 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/ecdhes.js:4:25:
      4 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/fallbackServiceStub.js:25:25:
      25 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/rsaes.js:4:25:
      4 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/aeskw.js:5:25:
      5 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js:5:25:
      5 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/retry-request/index.js:3:30:
      3 │ const {PassThrough} = require('stream');
        ╵                               ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/ciphers.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/streamingRetryRequest.js:14:32:
      14 │ const { PassThrough } = require('stream');
         ╵                                 ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/recursive-delete.js:4:23:
      4 │ const assert = require("assert");
        ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/pool.js:19:23:
      19 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js:3:25:
      3 │ const crypto_1 = require("crypto");
        ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/aggregate.js:20:23:
      20 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/bulk-writer.js:4:23:
      4 │ const assert = require("assert");
        ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/reference/query.js:19:25:
      19 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/node-fetch/lib/index.mjs:1:19:
      1 │ import Stream from 'stream';
        ╵                    ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js:21:25:
      21 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/document.js:20:23:
      20 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js:21:25:
      21 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/streamArrayParser.js:20:25:
      20 │ const stream_1 = require("stream");
         ╵                          ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/readable-stream/readable.js:1:21:
      1 │ var Stream = require('stream');
        ╵                      ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "http"

    node_modules/.pnpm/[email protected]/node_modules/node-fetch/lib/index.mjs:2:17:
      2 │ import http from 'http';
        ╵                  ~~~~~~

  The package "http" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/[email protected]/node_modules/node-fetch/lib/index.mjs:3:16:
      3 │ import Url from 'url';
        ╵                 ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/watch.js:19:23:
      19 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:33:17:
      33 │ var EE = require('events').EventEmitter;
         ╵                  ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/baseexternalclient.js:29:23:
      29 │ const stream = require("stream");
         ╵                        ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "child_process"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/googleauth.js:17:32:
      17 │ const child_process_1 = require("child_process");
         ╵                                 ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "querystring"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/refreshclient.js:18:30:
      18 │ const querystring_1 = require("querystring");
         ╵                               ~~~~~~~~~~~~~

  The package "querystring" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "stream"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/downscopedclient.js:17:23:
      17 │ const stream = require("stream");
         ╵                        ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "child_process"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/grpc.js:20:32:
      20 │ const child_process_1 = require("child_process");
         ╵                                 ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "querystring"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/oauth2client.js:18:28:
      18 │ const querystring = require("querystring");
         ╵                             ~~~~~~~~~~~~~

  The package "querystring" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/googleauth.js:18:19:
      18 │ const fs = require("fs");
         ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/reference/aggregate-query.js:19:23:
      19 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "events"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/authclient.js:17:25:
      17 │ const events_1 = require("events");
         ╵                          ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "https"

    node_modules/.pnpm/[email protected]/node_modules/node-fetch/lib/index.mjs:5:18:
      5 │ import https from 'https';
        ╵                   ~~~~~~~

  The package "https" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "assert"

    node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/rate-limiter.js:19:23:
      19 │ const assert = require("assert");
         ╵                        ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "crypto"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/crypto/node/crypto.js:17:23:
      17 │ const crypto = require("crypto");
         │                        ~~~~~~~~
         ╵                        "./crypto"

  The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/gcp-metadata/build/src/gcp-residency.js:19:21:
      19 │ const fs_1 = require("fs");
         ╵                      ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "url"

    node_modules/.pnpm/[email protected]/node_modules/gaxios/build/src/common.js:21:22:
      21 │ const url_1 = require("url");
         ╵                       ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/google-gax/build/src/grpc.js:21:19:
      21 │ const fs = require("fs");
         ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/.pnpm/[email protected]/node_modules/gtoken/build/src/index.js:22:19:
      22 │ const fs = require("fs");
         ╵                    ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "child_process"

    node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js:19:29:
      19 │ const childProcess = require("child_process");
         ╵                              ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node. Are you trying
  to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

@bholmesdev
Copy link
Contributor

@kunjee17 Oh boy, definitely looks like a mismatch between Firebase and Netlify's edge environment. I know that fs is reaching for the file system, which edge functions won't have access to.

It looks like firebase has a firebase-functions package for serverless environments. I'm not familiar with this API, but maybe it'll address those issues? You can also remove the edge flag from your adapter to try using the plain serverless API.

@kunjee17
Copy link

@bholmesdev hey, thanks for reply. Simple Serverless API works like charm. It is just edge functions are giving issues. Otherwise Astro + Netlify + Firebase works without any issues.

@mlafeldt
Copy link

mlafeldt commented Nov 6, 2024

For all those who ended up here searching for MessageChannel is not defined: here's my analysis of the problem and a possible solution: withastro/adapters#436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority)
Projects
None yet
Development

No branches or pull requests

10 participants