marcomafessolli / remix-prisma-cloudflare-workers

Run Remix with Prisma on Cloudflare Workers
MIT License
36 stars 3 forks source link

error: Could not resolve "async_hooks" #3

Open willin opened 2 years ago

willin commented 2 years ago

Describe the bug

yarn dev
yarn run v1.22.17
$ npm run build:remix && cross-env NODE_ENV=development concurrently "npm:dev:*"

> build:remix
> remix build

Building Remix app in production mode...
Built in 126ms
[dev:*remix]
[dev:*remix] > dev:remix
[dev:*remix] > remix watch
[dev:*remix]
[dev:*worker]
[dev:*worker] > dev:worker
[dev:*worker] > miniflare --build-command "node ./scripts/build.js" --watch
[dev:*worker]
[dev:*remix] Watching Remix app in development mode...
[dev:*worker] Building Worker in development mode
[dev:*worker]  > node_modules/@prisma/client/runtime/index.js:67:45: error: Could not resolve "async_hooks" (use "platform: 'node'" when building for node)
[dev:*worker]     67 │ var import_async_hooks = __toModule2(require("async_hooks"));
[dev:*worker]        ╵                                              ~~~~~~~~~~~~~
[dev:*worker]
[dev:*worker]  > node_modules/@prisma/client/runtime/index.js:27241:25: error: Could not resolve "_http_common" (use "platform: 'node'" when building for node)
[dev:*worker]     27241 │     var common = require("_http_common");
[dev:*worker]           ╵                          ~~~~~~~~~~~~~~
[dev:*worker]
[dev:*remix] 💿 Built in 170ms
[dev:*worker] Error: Build failed with 2 errors:
[dev:*worker] node_modules/@prisma/client/runtime/index.js:67:45: error: Could not resolve "async_hooks" (use "platform: 'node'" when building for node)
[dev:*worker] node_modules/@prisma/client/runtime/index.js:27241:25: error: Could not resolve "_http_common" (use "platform: 'node'" when building for node)
[dev:*worker]     at failureErrorWithLog (/Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:1493:15)
[dev:*worker]     at /Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:1151:28
[dev:*worker]     at runOnEndCallbacks (/Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:941:63)
[dev:*worker]     at buildResponseToResult (/Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:1149:7)
[dev:*worker]     at /Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:1258:14
[dev:*worker]     at /Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:629:9
[dev:*worker]     at handleIncomingPacket (/Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:726:9)
[dev:*worker]     at Socket.readFromStdout (/Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/esbuild/lib/main.js:596:7)
[dev:*worker]     at Socket.emit (node:events:390:28)
[dev:*worker]     at addChunk (node:internal/streams/readable:315:12) {
[dev:*worker]   errors: [
[dev:*worker]     {
[dev:*worker]       detail: undefined,
[dev:*worker]       location: [Object],
[dev:*worker]       notes: [],
[dev:*worker]       pluginName: '',
[dev:*worker]       text: `Could not resolve "async_hooks" (use "platform: 'node'" when building for node)`
[dev:*worker]     },
[dev:*worker]     {
[dev:*worker]       detail: undefined,
[dev:*worker]       location: [Object],
[dev:*worker]       notes: [],
[dev:*worker]       pluginName: '',
[dev:*worker]       text: `Could not resolve "_http_common" (use "platform: 'node'" when building for node)`
[dev:*worker]     }
[dev:*worker]   ],
[dev:*worker]   warnings: []
[dev:*worker] }
[dev:*worker] [mf:err] BuildError [1]: Build failed with exit code 1
[dev:*worker]     at ChildProcess.<anonymous> (file:///Users/v0/Projects/Authing/demos/remix-prisma-cloudflare-workers/node_modules/@miniflare/core/src/plugins/build.ts:71:25)
[dev:*worker]     at ChildProcess.emit (node:events:390:28)
[dev:*worker]     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
[dev:*worker] npm run dev:worker exited with code 1
^C
[dev:*remix] npm run dev:remix exited with code SIGINT

Your Example Website or App

just clone this repo

Steps to Reproduce the Bug or Issue

just clone this repo

Expected behavior

run properly

Screenshots or Videos

No response

Platform

Additional context

No response

marcomafessolli commented 2 years ago

Heey, please check https://github.com/marcomafessolli/remix-prisma-cloudflare-workers/issues/1 and see if that helps in someway. Ultimately, install and run this repo using npm instead of yarn (https://yarnpkg.com/advanced/lifecycle-scripts#a-note-about-postinstall)

marcomafessolli commented 2 years ago

@willin did you have any success?

willin commented 2 years ago

none

willin commented 2 years ago

is there a way capable with v1.2.1?

marcomafessolli commented 2 years ago

Currently this repo is using 1.2.1 and it is working. If you could, please, share npm install logs and PRISMA_CLIENT_ENGINE_TYPE=dataproxy npx prisma generate logs so we can see what is happening on your local env

BleedingDev commented 2 years ago

Had the same issue and running PRISMA_CLIENT_ENGINE_TYPE=dataproxy npx prisma generate helped, but I am stuck at Prisma Data Proxy as the page for acc creation is behaving really weird and crashes. :(

marcomafessolli commented 2 years ago

@pegak could you provide any logs? How is your env set up?

I'd love to be able to reproduce it in my machine and fix it.

BleedingDev commented 2 years ago

Windows 11 Powershell 7.2 Node 17.8 Npm 8.5

This is context I can give you out of my mind, I can give you more once I am back at my computer.

BleedingDev commented 2 years ago

As for Prisma Data Proxy I am stuck at their page, so nothing you can fix. :)