Repository navigation
fix(ssr): give the Appwrite env vars placeholder defaults - #20
Merged
Merged
Conversation
SvelteKit 3 validates declared env vars at build time, so building the demo without a filled-in .env failed with env_invalid. Placeholders (the Cloud endpoint, empty project ID and key) let it build; values in .env still take precedence.
🟢 Tier S · Ready to merge
Adds fallback schemas for the SSR demo’s Appwrite endpoint, project ID, and API key so builds can run without a populated
📂 Walkthrough · 2
Reviewed |
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.
Cause
Since the SvelteKit 3 migration in #18,
server-side-rendering/src/env.tsdeclaresPUBLIC_APPWRITE_ENDPOINT,PUBLIC_APPWRITE_PROJECT_IDandAPPWRITE_KEYas static variables with no schema, so each must be set. Kit validates them duringvite build, and the build fails withenv_invalidon any checkout without a filled-in.env, including the verify job in #19. Marking them non-static does not help, because Kit validates runtime variables at build time too.Fix
Give each variable a schema with a placeholder fallback: the Appwrite Cloud endpoint (
https://cloud.appwrite.io/v1, also node-appwrite's default) and empty strings for the project ID and API key. This follows theexample-authdemo, which hardcodes placeholder settings. No secret is committed.Values from
.envor the environment still take precedence, so following the README (copy.env.exampleto.envand fill it in) behaves as before. A committed.env.productionwas not used, because Vite ranks it above the user's.env.Also adds the shared verify caller (identical to #19) so this PR runs the same check.
Verification
On Node 24, in
server-side-rendering:npm ciandnpm run buildsucceed with no.env, inlining the placeholders..env, the build inlines its endpoint and project ID instead.npm run checkreports 0 errors and 0 warnings, and Prettier passes.Unblocks #19 and addresses Hansi's finding there.