Closed lordor5 closed 1 week ago
I don't know why but astro will only read public variables in the .env file and private variables on the .dev.vars file. It wil not read variables from the wrangler.toml file. I created a branch in the minimal reproductible example called env were you can test it.
That may be why the page dosent works on cloudflare but it works localy if both files are present.
If in 1 day I haven't followed up, feel free to ping me!
Alright I checked and it's intended at this time:
PUBLIC_API_URL="http//Public" npm run build
. This should work just fine on cloudflare. We have plans to get them from your wrangler automatically@lordor5 I'm curious, why do you use bun astro build && bun wrangler pages dev
instead of bun astro dev
. Is there any reason or issue, we can improve astro dev
?
Mainly because of env variables, I wasn't able to get them to work with bun astro dev
. That's why I wanted to update to the latest astro version to use getSecret() and for now, with the new update of @astrojs/cloudflare@11 all env variables works perfectly, so I'm not needing wrangler pages dev. I haven't been able to use getSecret() for a D1 db, but I assume It's a lack of knowledge on my part.
getSecret
is not made for bindings
Interesting that astro dev didn't work for you.
Astro Info
Describe the Bug
I'm getting the following error when a execute
bun astro build && bun wrangler pages dev
[EnvInvalidVariables] The following environment variables do not match the data type and/or properties defined in experimental.env.schema: Variable PUBLIC_API_URL is not of type: string.
The error goes away when I set optional: true
What's the expected result?
There shouldn't be an error
Link to Minimal Reproducible Example
https://github.com/lordor5/stllink2
Participation