NeonN
Neon13mo ago
9 replies
ordinary-sapphire

ECONNRESET error when trying to create a database from a javascript file

So I'm receiving the below error when trying to create a table from a js file using postgres. In the annexed images you can see how I wrote the code for creating the table. I was following a video doing the same, for him it worked, but not for me. The error doesn't happen if I use async, but the table doesn't get created either.

What's happening here and how to solve it?

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
    at cachedError (file:///C:/Users/bruno/projetos/node/node-do-zero/node_modules/postgres/src/query.js:170:23)
    at new Query (file:///C:/Users/bruno/projetos/node/node-do-zero/node_modules/postgres/src/query.js:36:24)
    at sql (file:///C:/Users/bruno/projetos/node/node-do-zero/node_modules/postgres/src/index.js:112:11)
    at file:///C:/Users/bruno/projetos/node/node-do-zero/create-videos-table.js:3:4 {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}
db.png
postgres.png
Was this page helpful?