Bierman
Bierman
CDCloudflare Developers
Created by Bierman on 4/10/2024 in #pages-help
next-on-pages process.env values are undefined
Hey! I was wondering if anyone has faced an issue where process.env values, such as process.env.NEXT_PUBLIC_API_URL is coming through as undefined on build? Both on deploy and preview with pages. In standard next development mode it works fine. I tried a normal next static export and serving that on a simple server, and that works fine. So somewhere in the cf build process I seem to be losing these values. I’m not using any of the cf services directly in this pages app, all that happens on a standalone worker (which is the api url im trying to connect to). This only happened when I migrated my code over to cloudflare from render. They were both set up nearly identically, with the env values being set in the environment variables section of the dashboard. As a sanity check I also tried moving my logic into a clean vite app, which also worked with the vite env syntax. Am i misunderstanding something basic about how cloudflare handles env values? I do not have a wrangler.toml for this next app, everything is handled in the repo and the environment variables in dashboard and a .env file locally. Any help would be appreciated, thank you!
1 replies
CDCloudflare Developers
Created by Bierman on 10/31/2023 in #workers-help
how to handle dependencies using node built-ins
Hey! I'm new to Cloudflare, and trying to convert my node server to work in Cloudflare workers instead. While my core code seems to work fine, I'm having issues with various dependencies that rely on node built-ins. I'm a bit confused as to how to handle these - is there a way to polyfill / compile with webpack or something more thorough than just the node_compat flag? Or for these packages require node:fs, node:util, node:stream should I just avoid entirely ? Will send the error message below
7 replies