solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

ERROR at cloudflare pages deployment

Open mentasuave01 opened this issue 2 years ago • 2 comments

Steps: After finish my project, I install pnpm solid-start-cloudflare-pages 0.2.7

update vite.config.ts to:

import { defineConfig } from "vite";
import solid from "solid-start/vite";
import cloudflare from "solid-start-cloudflare-pages";

export default defineConfig({
  plugins: [solid({ adapter: cloudflare({}) })],
});

install wrangler, then create a wrangler login and auth and then use this command: CLOUDFLARE_ACCOUNT_ID=MY_ACCOUNT_ID npx wrangler pages publish dist/public --project-name=PROJECT_NAME

Response from console:

▲ [WARNING] Comparison with -0 using the "===" operator will also match 0 [equals-negative-zero]

    functions/[[path]].js:50833:29:
      50833 │             } else if (x === -0) { // don't return negative zero
            ╵                              ~~

  Floating-point equality is defined such that 0 and -0 are equal, so "x === -0" returns true for
  both 0 and -0. You need to use "Object.is(x, -0)" instead to test for -0.

25 error(s) and 1 warning(s) when compiling Worker.

✘ [ERROR] Could not resolve "http"

    [[path]].js:1:25:
      1 │ import require$$1$6 from 'http';
        ╵                          ~~~~~~

  The package "http" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "https"

    [[path]].js:2:25:
      2 │ import require$$2$5 from 'https';
        ╵                          ~~~~~~~

  The package "https" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "url"

    [[path]].js:3:25:
      3 │ import require$$0$c from 'url';
        ╵                          ~~~~~

  The package "url" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "stream"

    [[path]].js:4:19:
      4 │ import Stream from 'stream';
        ╵                    ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "assert"

    [[path]].js:5:25:
      5 │ import require$$0$d from 'assert';
        ╵                          ~~~~~~~~

  The package "assert" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "tty"

    [[path]].js:6:25:
      6 │ import require$$0$b from 'tty';
        ╵                          ~~~~~

  The package "tty" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "util"

    [[path]].js:7:25:
      7 │ import require$$1$5 from 'util';
        ╵                          ~~~~~~

  The package "util" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "os"

    [[path]].js:8:25:
      8 │ import require$$2$4 from 'os';
        ╵                          ~~~~

  The package "os" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "zlib"

    [[path]].js:9:19:
      9 │ import zlib$4 from 'zlib';
        ╵                    ~~~~~~

  The package "zlib" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "path"

    [[path]].js:10:25:
      10 │ import require$$1$7 from 'path';
         ╵                          ~~~~~~

  The package "path" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "fs"

    [[path]].js:11:25:
      11 │ import require$$0$e from 'fs';
         ╵                          ~~~~

  The package "fs" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "buffer"

    [[path]].js:12:25:
      12 │ import require$$0$f from 'buffer';
         ╵                          ~~~~~~~~

  The package "buffer" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "crypto"

    [[path]].js:13:25:
      13 │ import require$$0$g from 'crypto';
         ╵                          ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "events"

    [[path]].js:14:25:
      14 │ import require$$0$h from 'events';
         ╵                          ~~~~~~~~

  The package "events" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "string_decoder/"

    [[path]].js:15:26:
      15 │ import require$$10$3 from 'string_decoder/';
         ╵                           ~~~~~~~~~~~~~~~~~

  You can mark the path "string_decoder/" as external to exclude it from the bundle, which will remove this error.


✘ [ERROR] Could not resolve "net"

    [[path]].js:16:25:
      16 │ import require$$0$i from 'net';
         ╵                          ~~~~~

  The package "net" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "punycode"

    [[path]].js:17:25:
      17 │ import require$$0$j from 'punycode';
         ╵                          ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "constants"

    [[path]].js:18:25:
      18 │ import require$$0$k from 'constants';
         ╵                          ~~~~~~~~~~~

  The package "constants" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "async_hooks"

    [[path]].js:19:25:
      19 │ import require$$1$8 from 'async_hooks';
         ╵                          ~~~~~~~~~~~~~

  The package "async_hooks" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "dns"

    [[path]].js:20:25:
      20 │ import require$$0$l from 'dns';
         ╵                          ~~~~~

  The package "dns" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "http2"

    [[path]].js:21:25:
      21 │ import require$$0$m from 'http2';
         ╵                          ~~~~~~~

  The package "http2" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "tls"

    [[path]].js:22:25:
      22 │ import require$$1$9 from 'tls';
         ╵                          ~~~~~

  The package "tls" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "string_decoder"

    [[path]].js:23:25:
      23 │ import require$$2$6 from 'string_decoder';
         ╵                          ~~~~~~~~~~~~~~~~

  The package "string_decoder" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "child_process"

    [[path]].js:24:25:
      24 │ import require$$4$6 from 'child_process';
         ╵                          ~~~~~~~~~~~~~~~

  The package "child_process" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


✘ [ERROR] Could not resolve "querystring"

    [[path]].js:25:25:
      25 │ import require$$4$5 from 'querystring';
         ╵                          ~~~~~~~~~~~~~

  The package "querystring" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file to enable Node compatibility.


▲ [WARNING] Comparison with -0 using the "===" operator will also match 0 [equals-negative-zero]

    [[path]].js:50833:29:
      50833 │             } else if (x === -0) { // don't return negative zero
            ╵                              ~~

  Floating-point equality is defined such that 0 and -0 are equal, so "x === -0" returns true for both 0 and -0. You need to use "Object.is(x, -0)" instead to test for -0.


✘ [ERROR] Build failed with 25 errors:

  [[path]].js:1:25: ERROR: Could not resolve "http"
  [[path]].js:2:25: ERROR: Could not resolve "https"
  [[path]].js:3:25: ERROR: Could not resolve "url"
  [[path]].js:4:19: ERROR: Could not resolve "stream"
  [[path]].js:5:25: ERROR: Could not resolve "assert"
  ...

image

mentasuave01 avatar Dec 05 '22 09:12 mentasuave01

Yeah that is definitely the node build. Cleaning out dist and running pnpm build again.

ryansolid avatar Dec 05 '22 10:12 ryansolid

I deleted node_modules, dist and functions. After that: pnpm i, pnpm build and cloudflare command. Same issue.

I have these messages at build:


> solid-start build

 solid-start build 
 version  0.2.7
(Use `node --trace-warnings ...` to show where the warning was created)
 adapter  cloudflare-pages

solid-start building client...
vite v3.2.4 building for production...
✓ 58 modules transformed.
dist/public/manifest.json                      0.96 KiB
dist/public/ssr-manifest.json                  2.88 KiB
dist/public/assets/_...404_.5bacf5c1.js        0.57 KiB / gzip: 0.38 KiB
dist/public/assets/browser.103a9b8c.js         2.51 KiB / gzip: 1.08 KiB
dist/public/assets/entry-client.d870915a.css   0.37 KiB / gzip: 0.26 KiB
dist/public/assets/index.79b817c0.js           5.39 KiB / gzip: 2.24 KiB
dist/public/assets/entry-client.ea49d324.js    33.71 KiB / gzip: 13.04 KiB
solid-start client built in: 884.943ms

solid-start building server...
vite v3.2.4 building SSR bundle for production...
✓ 57 modules transformed.
.solid/server/manifest.json     0.18 KiB
.solid/server/entry-server.js   56.22 KiB
solid-start server built in: 452.809ms

The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
Circular dependency: node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js -> node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_duplex.js -> node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js
Circular dependency: node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_duplex.js -> node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js -> node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_duplex.js

mentasuave01 avatar Dec 05 '22 10:12 mentasuave01

Are you using a node library? Like Prisma or something? It just looks like node core libraries are getting pulled in from that error.

ryansolid avatar Dec 08 '22 06:12 ryansolid

looks like an issue with one of the dependencies, I will close this and try to get support on the package site

mentasuave01 avatar Dec 08 '22 10:12 mentasuave01