wminor
wminor5d ago

Trouble setting up convex-r2

I'm trying to set up convex-r2, following this guide: https://www.convex.dev/components/cloudflare-r2 I'm getting this error from convex dev:
Error fetching POST https://combative-opossum-472.convex.cloud/api/deploy2/start_push 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze file_storage.js: Uncaught Error: R2 configuration is missing required fields.
R2_BUCKET, R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY
at new R2 (../node_modules/@convex-dev/r2/src/client/index.ts:94:74)
at <anonymous> (../src/convex/file_storage.ts:3:38)
Error fetching POST https://combative-opossum-472.convex.cloud/api/deploy2/start_push 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze file_storage.js: Uncaught Error: R2 configuration is missing required fields.
R2_BUCKET, R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY
at new R2 (../node_modules/@convex-dev/r2/src/client/index.ts:94:74)
at <anonymous> (../src/convex/file_storage.ts:3:38)
Am I right in thinking that those logs are coming from remote execution on the convex server side? I have ensured that all of those R2_* environment variables are set on my convex project. What else could I be missing?
Convex
Cloudflare R2
Store and serve files from Cloudflare R2.
4 Replies
Convex Bot
Convex Bot5d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart4d ago
That message is saying they're not set. Any chance you're checking a different deployment than the one being used? You can be sure by running npx convex dashboard from wherever you're running convex dev, it'll open the correct deployment. Then you can check env vars there.
wminor
wminorOP4d ago
Well, this is embarassing - I had a typo in one of the env var names. Must have stared at it 20 times without noticing. Classic Thanks for taking a look all the same!
erquhart
erquhart4d ago
No problem - I should probably update it to say which variable is missing specifically, would have helped here.

Did you find this page helpful?