vite:build on CloudFlare #8699
Replies: 7 comments 5 replies
-
OK the issue here was installGlobals() in the vite.config.ts file, causes a lockup or something on CF. No error messages, just freezes their build completly. |
Beta Was this translation helpful? Give feedback.
-
Now the 3 messages I am getting are... 16:09:39.191 ../node_modules/stream-slice/index.js:3:24: |
Beta Was this translation helpful? Give feedback.
-
I have the same issue: Have you found a fix yet? |
Beta Was this translation helpful? Give feedback.
-
No I didn't get it working with CF, in the end I was using remix-run/node locally and deploying using remix-run/cloudflare. Fly.io and Supabase are working together right now, I'm now starting with a new beta product, so I can have managed PG right next to my fly server, so data access should be almost instant. Good luck! P.S. to be honest I stopped a few Remix versions ago to get CF working, have you got their latest builds installed? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Ensure you aren't using anything from |
Beta Was this translation helpful? Give feedback.
-
Not sure if this will help anyone but I thought to share my experience and how I solved my own issue, even though it isn't prisma related. Similar to @NicoCPH, I was receiving errors such as:
... and so on during my Remix Cloudflare pages preview ( I quadruple-checked literally everywhere in my app to make sure I was using I tried using the wrangler I tried using all of the various vite polyfill libraries or the installGlobals approach for my vite build config. It seemed to have no impact. Things were looking dire and I felt like my goose was cooked. It seemed like there was literally nowhere in my app, at least that I could control, that I could change to fix the issue. I ended up using the I was using the Firebase SDK for app user authentication and it turns out it was the But also, beyond that, the SDK libraries are HUGE and make your bundle huge as well (FYI, the size limit for Cloudflare pages workers is 1MB on the free tier, 10MB on paid I think. My bundle was 15+ when using the nodejs_compat_v2 flag, wtf lol). Luckily, it turns out that Firebase has an API for its authentication. So I converted all my calls to the SDK to use the API instead, which wasn't exactly a small feat, but soooo worth it. This resulted in not having to bundle the problematic firebase libraries and not having to rely on the wrangler nodejs_compat flags, which allowed me to build successfully. At any rate, I hope that anyone might find this helpful, even if for nothing other than to help reframe how you might approach the problem (use an API or non-built in alternative to built-in node libraries for cloudflare pages apps). If nothing else the |
Beta Was this translation helpful? Give feedback.
-
I need some assistance on getting an app working on CloudFlare using Vite. I have upgraded to 2.6.0 and am trying to deploy to CF, but the build gets stuck on remix vite:build. Nothing happens, no errors, nothing. I guess I'm really asking for tips on how to debug, are there logs anywhere that I can use to find out why this is happening. Below is the log that CF is providing, not much there to see??
2024-02-05T21:26:47.323833974Z Cloning repository...
2024-02-05T21:26:48.613009082Z From https://github.com/JasonColeyNZ/schedule-app
2024-02-05T21:26:48.613049543Z * branch 8ad7ad9ad203b763b1e9fb6a9e948c103c202d28 -> FETCH_HEAD
2024-02-05T21:26:48.613055302Z
2024-02-05T21:26:48.734193423Z HEAD is now at 8ad7ad9 fixes to build
2024-02-05T21:26:48.734593186Z
2024-02-05T21:26:48.830018665Z
2024-02-05T21:26:48.832759432Z Using v2 root directory strategy
2024-02-05T21:26:48.866003488Z Success: Finished cloning repository files
2024-02-05T21:26:49.685473631Z Detected the following tools from environment: npm@9.6.7, nodejs@18.17.1
2024-02-05T21:26:49.685854092Z Installing project dependencies: npm clean-install --progress=false
2024-02-05T21:26:55.984271978Z npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
2024-02-05T21:26:56.66324666Z npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
2024-02-05T21:26:56.732313011Z npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
2024-02-05T21:26:56.732943495Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2024-02-05T21:26:56.766065351Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2024-02-05T21:26:56.997683757Z npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
2024-02-05T21:26:58.188333718Z npm WARN deprecated superagent@3.8.1: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at https://github.com/visionmedia/superagent/releases.
2024-02-05T21:26:58.90029228Z npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
2024-02-05T21:27:28.34165693Z
2024-02-05T21:27:28.342010702Z > postinstall
2024-02-05T21:27:28.342037562Z > prisma generate
2024-02-05T21:27:28.342204636Z
2024-02-05T21:27:28.975616871Z Prisma schema loaded from app/database/schema.prisma
2024-02-05T21:27:30.117549544Z
2024-02-05T21:27:30.117661711Z ✔ Generated Prisma Client (v5.9.1) to ./node_modules/@prisma/client in 537ms
2024-02-05T21:27:30.117853462Z
2024-02-05T21:27:30.118031018Z Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
2024-02-05T21:27:30.118380765Z
2024-02-05T21:27:30.11840776Z import { PrismaClient } from '@prisma/client' 2024-02-05T21:27:30.118693519Z const prisma = new PrismaClient() 2024-02-05T21:27:30.118826465Z
2024-02-05T21:27:30.119031962Z or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
2024-02-05T21:27:30.119186627Z
2024-02-05T21:27:30.11940529Z import { PrismaClient } from '@prisma/client/edge' 2024-02-05T21:27:30.119478897Z const prisma = new PrismaClient() 2024-02-05T21:27:30.119660007Z
2024-02-05T21:27:30.119990724Z
2024-02-05T21:27:30.120073248Z See other ways of importing Prisma Client: http://pris.ly/d/importing-client
2024-02-05T21:27:30.120229425Z
2024-02-05T21:27:30.120361875Z ┌─────────────────────────────────────────────────────────────┐
2024-02-05T21:27:30.120532132Z │ Deploying your app to serverless or edge functions? │
2024-02-05T21:27:30.120842208Z │ Try Prisma Accelerate for connection pooling and caching. │
2024-02-05T21:27:30.121003871Z │ https://pris.ly/cli/accelerate │
2024-02-05T21:27:30.121190065Z └─────────────────────────────────────────────────────────────┘
2024-02-05T21:27:30.121360643Z
2024-02-05T21:27:30.224164562Z
2024-02-05T21:27:30.224754808Z added 1567 packages, and audited 1785 packages in 40s
2024-02-05T21:27:30.224779119Z
2024-02-05T21:27:30.225453988Z 371 packages are looking for funding
2024-02-05T21:27:30.225772373Z run
npm fund
for details2024-02-05T21:27:30.229641973Z
2024-02-05T21:27:30.230041476Z 2 moderate severity vulnerabilities
2024-02-05T21:27:30.230432153Z
2024-02-05T21:27:30.230440911Z Some issues need review, and may require choosing
2024-02-05T21:27:30.230511131Z a different dependency.
2024-02-05T21:27:30.230838688Z
2024-02-05T21:27:30.231038783Z Run
npm audit
for details.2024-02-05T21:27:30.253779864Z Executing user command: npm run build
2024-02-05T21:27:30.925516833Z
2024-02-05T21:27:30.925719144Z > build
2024-02-05T21:27:30.925876473Z > remix vite:build
2024-02-05T21:27:30.926044611Z
Beta Was this translation helpful? Give feedback.
All reactions