0

When I use the command to create a Cloudflare D1 database:

npx wrangler d1 create sonicjs

The binding I get is "DB" Now when running npm run dev, I encounter an error: Cannot read properties of undefined (reading 'prepare') When I change the binding to "D1", it runs normally But when I submit registration information, a new error occurs. I don't know how to solve this problem. Can someone help?

The World's Fastest API Framework!

[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.
isAdminAccountCreated register false
10:14:42 [200] /admin/register 136ms
isAdminAccountCreated register false
json register {"data":{"firstName":"John","lastName":"Doe","email":"[email protected]","password":"123456789","role":"admin"}}
http://localhost:4321/api/v1/users
Error: TypeError: fetch failed
    at node:internal/deps/undici/undici:13502:13
    at async eval (D:/mywebsite/sonicjs/sonicjs/src/pages/admin/register/index.astro:42:26)
    at async callComponentAsTemplateResultOrResponse (file:///D:/mywebsite/sonicjs/sonicjs/node_modules/astro/dist/runtime/server/render/astro/render.js:90:25)
...
  [cause]: Error: read ECONNRESET
      at TCP.onStreamRead (node:internal/stream_base_commons:216:20)
      at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
    errno: -4077,
    code: 'ECONNRESET',
    syscall: 'read'
  }
}

I tried searching GitHub issues and consulting AI, but couldn't find a solution.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.