Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vercel edge private env vars #6841

Merged
merged 1 commit into from
Apr 14, 2023
Merged

Fix vercel edge private env vars #6841

merged 1 commit into from
Apr 14, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 14, 2023

Changes

Fix #6713

When building for Vercel edge with ssr.target: 'webworker' in Vite, make sure Vite doesn't replace process.env as ({}) so they work in Vercel edge runtime on deploy.

cc @matthewp, didn't mean to steal your fix, but i was playing around some things while debugging it and found a fix 😬

Testing

Ran the issue's repro https://github.com/larryhudson/astro-vercel-edge-env-testing and run MY_ENV_VAR=foo npm run build to build it.

After that, I open .vercel/output/functions/render.func/chunks/pages/all.00bba6ec.mjs to verify that the MY_ENV_VAR is correctly preserved as process.env.MY_ENV_VAR, not {}.MY_ENV_VAR.

Docs

n/a. bug fix.

@changeset-bot
Copy link

changeset-bot bot commented Apr 14, 2023

🦋 Changeset detected

Latest commit: b6533d7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Apr 14, 2023
@bluwy bluwy merged commit 2e3125e into main Apr 14, 2023
@bluwy bluwy deleted the fix-vercel-edge-env branch April 14, 2023 13:46
@astrobot-houston astrobot-houston mentioned this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

without PUBLIC_ prefix environment variables not working with react + @astrojs/vercel/edge
2 participants