Skip to content

I can't publish to Cloudflare Workers #46

@nulltask

Description

@nulltask

Version

node: 18.3.0
@nuxtjs/supabase: 0.1.16
nuxt: 3.0.0-rc.3

Reproduction Link

https://github.com/nulltask/supabase-module-repro

Steps to reproduce

% npm install
% npx wrangler publish

What is Expected?

Publish the website to Cloudflare Workers successfully.

What is actually happening?

The following error message was output.
Remove @nuxtjs/supabase from modules, then I can publish website successfully.

% npx wrangler publish      
 ⛅️ wrangler 2.0.7 (update available 2.0.8)
-----------------------------------------------------
Running custom build: NITRO_PRESET=cloudflare npm run build

> build
> nuxt build

Nuxt CLI v3.0.0-rc.3                                                                                          14:57:19

 ERROR  (node:64807) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

ℹ Vite client warmed up in 1170ms                                                                             14:57:22
ℹ Client built in 1212ms                                                                                      14:57:22
ℹ Building server...                                                                                          14:57:22
✔ Server built in 551ms                                                                                       14:57:23
✔ Generated public .output/public                                                                       nitro 14:57:23
start Building server...                                                                                nitro 14:57:23
start Writing server bundle...                                                                          nitro 14:57:24
✔ Server built                                                                                          nitro 14:57:26
  └─ .output/server/index.mjs (488 kB) (150 kB gzip)
Σ Total size: 488 kB (150 kB gzip)
✔ You can preview this build using npx miniflare .output/server/index.mjs --site .output/public         nitro 14:57:26
✔ You can deploy this build using cd .output/server && npx wrangler publish                             nitro 14:57:26
✘ [ERROR] [plugin checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.

    node_modules/node-gyp-build/index.js:1:17:
      1 │ var fs = require('fs')
        ╵                  ~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/wrangler/wrangler-dist/cli.js:121207:11:
      121207 │     build6.onResolve({
             ╵            ~~~~~~~~~

    at setup (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121207:12)
    at handlePlugins (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:843:23)
    at Object.buildOrServe (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1137:7)
    at /Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2079:17
    at new Promise (<anonymous>)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2078:14)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1927:51)
    at bundleWorker (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121235:33)
    at publish (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:124352:67)

✘ [ERROR] [plugin checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.

    node_modules/node-gyp-build/index.js:2:19:
      2 │ var path = require('path')
        ╵                    ~~~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/wrangler/wrangler-dist/cli.js:121207:11:
      121207 │     build6.onResolve({
             ╵            ~~~~~~~~~

    at setup (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121207:12)
    at handlePlugins (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:843:23)
    at Object.buildOrServe (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1137:7)
    at /Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2079:17
    at new Promise (<anonymous>)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2078:14)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1927:51)
    at bundleWorker (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121235:33)
    at publish (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:124352:67)

✘ [ERROR] [plugin checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.

    node_modules/node-gyp-build/index.js:3:17:
      3 │ var os = require('os')
        ╵                  ~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/wrangler/wrangler-dist/cli.js:121207:11:
      121207 │     build6.onResolve({
             ╵            ~~~~~~~~~

    at setup (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121207:12)
    at handlePlugins (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:843:23)
    at Object.buildOrServe (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1137:7)
    at /Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2079:17
    at new Promise (<anonymous>)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:2078:14)
    at Object.build (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/node_modules/esbuild/lib/main.js:1927:51)
    at bundleWorker (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:121235:33)
    at publish (/Users/nulltask/Documents/GitHub/supabase-module-repro/node_modules/wrangler/wrangler-dist/cli.js:124352:67)


✘ [ERROR] Build failed with 3 errors:

  node_modules/node-gyp-build/index.js:1:17: ERROR: [plugin: checkForNodeBuiltins] Detected a Node
  builtin module import while Node compatibility is disabled.
  Add node_compat = true to your wrangler.toml file to enable Node compatibility.
  node_modules/node-gyp-build/index.js:2:19: ERROR: [plugin: checkForNodeBuiltins] Detected a Node
  builtin module import while Node compatibility is disabled.
  Add node_compat = true to your wrangler.toml file to enable Node compatibility.
  node_modules/node-gyp-build/index.js:3:17: ERROR: [plugin: checkForNodeBuiltins] Detected a Node
  builtin module import while Node compatibility is disabled.
  Add node_compat = true to your wrangler.toml file to enable Node compatibility.


If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions