You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SonicJS部署问题:D1绑定调整后注册遇ECONNRESET错误求助

问题详情
  1. 创建Cloudflare D1数据库时执行命令:
    npx wrangler d1 create sonicjs
    
    得到的绑定名称为DB。
  2. 运行npm run dev时触发错误:
    Cannot read properties of undefined (reading 'prepare')
    
  3. 将绑定名称改为D1后,项目可正常启动,但提交注册信息时出现新错误,日志如下:
    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":"test@gmail.com","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'
      }
    }
    

已查阅GitHub issues并咨询AI,未找到有效解决方案,请求协助排查问题。

内容的提问来源于stack exchange,提问作者Loen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 15:03:12