Closed handshou closed 8 months ago
Documentation requires env var name change too.
See end of page, https://start.open.gov.sg/docs/optional-features/storage
We've updated the env vars to use a single bucket (and subdirectories) via a combination of R2_IMAGES_DIRECTORY
. Updated the docs to reflect this https://github.com/opengovsg/starter-kit-docs/pull/37
Describe the bug Implementing avatar upload feature by entering R2 environment variables leads to an error toast message, "Avatar upload feature is not enabled".
On further inspection, the environment variable
R2_BUCKET_NAME
is incorrectly named. Correct name isR2_AVATARS_BUCKET_NAME
.To Reproduce Steps to reproduce the behavior:
.env.development.local
or creating Vercel project environment variables.Avatar upload feature is not enabled
.Expected behavior Be able to upload a photo after adding R2 environment variables.
Additional context The issue is a relatively easy find, but what made it frustrating was trying to find the right variables on Cloudflare. After ensuring all variables were correct, CORS was fine, and then running into this issue almost made me flip the table.
See where the variable is referenced, https://github.com/opengovsg/starter-kit/blob/d6d0265d17bcb8d3525dda62a98919db9d969710/src/server/modules/storage/storage.router.ts#L23