R2 <> NextJS

I can get the bucket configured to my proccess.env however it says all the objects are empty. Also, the bucket is working on my production build.
5 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Danny
DannyOP3y ago
No the object appears as R2Bucket {}, in the command line. I can see some options, like objects: {} inside of it
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Danny
DannyOP3y ago
okay that's good to know. I've been trying const obj = await process.env.CRYPTO_NOTIFICATIONS.get('gainers.csv'); which works on my production branch and wasn't working locally, so I tried console logging the process.env.CRYPTO_NOTIFICATIONS This seems to work when i run the wrangler on the production build
if (obj === null) {
return new Response('Not found', { status: 404 });
}
if (obj === null) {
return new Response('Not found', { status: 404 });
}
but then this code triggers, so the env avraible is there but the object is null If i define my bindings in my wrangler.toml do I have to run the command with --r2=BUCKET ? and is --local needed?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?