n00b Q: next-on-pages + D1 binding

i have seen some conversations and examples on discord, but still running into some mistakes,

  1. if i try to access a d1 binding using the suggested dev approach (watch build + wrangler pages dev), i am able to access the d1 instance (the instance is not undefined and the
    dev
    command shows a binding to the d1 db created from the gui), but not view the table (e.g., wrangler crashes saying table does not exist, but i can confirm it exists by using the CLI), i think i am misunderstanding how wrangler pages links to the d1 db, i.e., does the dev command create a local one or is there a flag to pass?
  2. when using the
    npm run dev
    • cf-proxy workflow, i am able to access kv, but not d1, e.g., it returns undefined when wrapping it: binding(process.env.db),
if there is any documentation or an example repo please do not hesitate to simply link me there! the KV repo example was super informative, not sure if there is anything else like that
Was this page helpful?