Fix: remove unneeded @std/dotenv/load import breaking Vercel deployment - #471
Closed
diogocouto18 wants to merge 1 commit into
Closed
diogocouto18 wants to merge 1 commit into
diogocouto18 wants to merge 1 commit into
Conversation
The @std/dotenv/load import is for reading a local .env file, which isn't needed on Vercel (env vars are injected directly into the process). The vercel-deno runtime couldn't resolve the JSR subpath import at request time (read-only filesystem), causing every request to 500. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AuvPSLEqW2zd8CbM2cbEdF
Author
|
Closing in favor of #469, which reaches the same root cause fix (bare |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deploying this project to Vercel (via the
vercel-denoruntime declared invercel.json) fails on every request with a 500 error:Cause
api/index.tsimports@std/dotenv/load, which loads a local.envfile intoDeno.env. On Vercel this import is resolved lazily at request time by thevercel-denoruntime, which tries to write to its JSR dependency cache — but Vercel's serverless function filesystem is read-only, so the import fails and every request 500s.The import isn't actually needed in this environment: Vercel already injects environment variables directly into the process, so there's no
.envfile to load in the first place.Fix
Remove the
import "@std/dotenv/load";line. No other changes.Testing
Verified on a personal fork deployed to Vercel: before the fix, every request returned
500 FUNCTION_INVOCATION_FAILED; after removing the import, the trophy SVG renders correctly.