My code is executed in the build step, crashing because of missing env vars

So I have a solid-start project that I want to deploy to pages. I have a problem with deployment to Cloudflare pages though. After the build is complete and code is uploaded, my code is executed in the build step. This leads to a deploy error, because the environment variables aren't available so the code throws. Why does this happen? It doesn't make sense to me. As the error happens after upload I suspect this is not an error with solid-start, but I could be wrong about that of course.
09:30:24.186 Found _routes.json in output directory. Uploading.
09:30:24.202 Validating asset output directory
09:30:25.129 Deploying your site to Cloudflare's global network...
09:30:28.310 Uploading... (38/45)
09:30:28.909 Uploading... (40/45)
09:30:28.925 Uploading... (43/45)
09:30:28.993 Uploading... (45/45)
09:30:28.994 ✨ Success! Uploaded 7 files (38 already uploaded) (1.01 sec)
09:30:28.994
09:30:29.231 ✨ Upload complete!
09:30:31.427 Success: Assets published!
09:30:32.382 Error: Failed to publish your Function. Got error: Uncaught Error: No connection string
at chunks/nitro/cloudflare-pages.mjs:7:32544
09:30:24.186 Found _routes.json in output directory. Uploading.
09:30:24.202 Validating asset output directory
09:30:25.129 Deploying your site to Cloudflare's global network...
09:30:28.310 Uploading... (38/45)
09:30:28.909 Uploading... (40/45)
09:30:28.925 Uploading... (43/45)
09:30:28.993 Uploading... (45/45)
09:30:28.994 ✨ Success! Uploaded 7 files (38 already uploaded) (1.01 sec)
09:30:28.994
09:30:29.231 ✨ Upload complete!
09:30:31.427 Success: Assets published!
09:30:32.382 Error: Failed to publish your Function. Got error: Uncaught Error: No connection string
at chunks/nitro/cloudflare-pages.mjs:7:32544
2 Replies
Jakob Norlin
Jakob Norlin9mo ago
I don't expect my code to run until I visit the app. The "No connection string" error is thrown by me
Rubi
Rubi9mo ago
I think it's something related with ENV and secret
Want results from more Discord servers?
Add your server