GitHub - mw10013/remix-auth-totp-cloudfl...

Yes, that works with remix+vite. I found that it’s not necessary to specify the bindings in the command line when running locally. Just let ‘remix vite:dev’ pick them up from wrangler.toml and include the local bindings in the wrangler.toml. I put together the cloudflare example for ‘remix-auth-totp’ that uses drizzle with d1 that has the local bindings in wrangler.toml. https://github.com/mw10013/remix-auth-totp-cloudflare-example
GitHub
GitHub - mw10013/remix-auth-totp-cloudflare-example
Contribute to mw10013/remix-auth-totp-cloudflare-example development by creating an account on GitHub.
5 Replies
melodyclue
melodyclue8mo ago
@mw10013 Thank you! It worked after I followed your code. local bindings" can be a hypothetical name like "intentionally-dummy-id-leave-as-is"?
mw10013
mw10013OP8mo ago
Yes, the database_id for the local environment can be anything so can just leave it as "intentionally-dummy-id-leave-as-is" if you copy/paste from the wrangler.toml. The approach is to try to completely separate the local, preview, and production environments in wrangler.toml. The local environment does not have a d1 database in cloudflare's cloud. The preview and production environments do so they need real database_id's in the wrangler.tom.
melodyclue
melodyclue8mo ago
@mw10013 I see. I couldn't find in the documentation that to reference the local DB, we need to include a dummy database_id. Is there such a thing?
mw10013
mw10013OP8mo ago
It's not in the cloudflare docs. Just an approach/convention that I'm using. Found the docs for specifying pages bindings in wrangler.toml to be a little confusing.
melodyclue
melodyclue8mo ago
@mw10013 Understood. For now, it seems like local development is possible. Thank you.
Want results from more Discord servers?
Add your server