n00b Q: wrangler / pages d1 env Qs
hello all, attempting to get next-on-pages dev env working with d1,
1. i realized it's defaulting to local, but i am unable to pass the --remote flag, as it throws an error saying its unrecognized:
i think its because this is
wrangler pages dev
and not wrangler dev
, but in pages it states to use --local
, i tried that as well and it just defaults to local anyway:
2. i also realized when i use wrangler commands its defaulting to cloud/non local so i was getting confused between the two envs, how do i set wrangler to target pages-dev env? there doesn't appear to be a --local
flag for the d1 commands, also doesn't appear to be a port flag to target the local 8788 env created by pages dev
not sure if this should go here, in wrangler, or in d1, if anyone has any suggestions super open or if there is a part of the docs i missed please do not hesitate to let me know!5 Replies
ohhhhhh that would explain so much hehehe, okay cool, great to know!
is there a way to get wrangler D1 to talk to local pages?
okay i mean like is there a setting for the
wrangler d1 {commands}
to sync with local, sorry if thats a dumb Q and thats what you meant that they can't be mixed, just wanted to clarify
since its running locally just feels like there is a way to tell it to talk to that instance but maybe not
okay super unfortunate, but thank you for letting me know! i am not sure how to mark these as resolved, but if there is a mod please go ahead,
appreciate the quick replies and thanks again!Just add —local to them
thanks for the suggestion! i am a huge n00b and don't understand:
is the flag passed another way? when i do
wrangler d1 --help
i see there are some flags for env
and config
,
also i do see --local
as available for some commands like kv:key
, but not for d1
It doesn’t exist for list since there is no central local store for databases
It exists on stuff like execute which you’d use in the same folder as the Worker
okay super fascinating! did not know this!
unfortunately i am still not getting them to work together,
do i adjust the .toml file to point to local?
when you say same folder as the worker, i am doing this at the root level of the
next-on-pages
directory, should it be nested inside the app directory? the only way i accessed local before was by running code inside one of the page.tsx
files, wondering if that is the way, or alternatively just using a api/route as a way to write commands to the DB
also thank you so much for the quick reply and sorry to be a nag! if there is a doc to look at please don't hesitate to point me there as well!