halvardssm / deno-nessie

A modular Deno library for PostgreSQL, MySQL, MariaDB and SQLite migrations
MIT License
527 stars 31 forks source link

[QUESTION] Unable to connect #92

Closed bramirez96 closed 3 years ago

bramirez96 commented 3 years ago

Hello again and sorry to be a bother,

I'm currently getting the following error when attempting to run migrations:

AddrNotAvailable: The requested address is not valid in its context. (os error 10049)
    at processResponse (deno:core/core.js:223:11)    at Object.jsonOpAsync (deno:core/core.js:240:12)
    at async Object.connect (deno:runtime/js/30_net.js:206:13)
    at async Connection.startup (connection.ts:143:17)
    at async Client.connect (client.ts:14:5)     
    at async ClientPostgreSQL.prepare (ClientPostgreSQL.ts:38:5)
    at async run (cli.ts:71:9)

I'm using the same connection object when connecting to my database with Postgres and it is connecting fine and I'm able to run queries. I've ran the script with reload and I've done other debugging making sure that the correct config file is being loaded. If I dont' specify a config location, I get an error for being the wrong user, and when I specify the correct location I get this error instead, so I know it's loading properly. Unsure how to procedd and curious if you've seen this error before or could at least point me in the right direction?

halvardssm commented 3 years ago

Hi @bramirez96 !

No problem, it's the first time I have heard of or seen this error. Do you have a link to your project? Or could you make a minimal example so that I can see if there might be something?

bramirez96 commented 3 years ago

Yes, thanks! Here's a link to the repo: https://github.com/bramirez96/deno-server-ss.

It's my first Deno project as well and it's heavily in construction, so if you have any other unrelated suggestions, I'm very open to hearing them! Again, my postgres database connects perfectly fine when I'm running queries, but falls flat when I attempt migrations.

halvardssm commented 3 years ago

I couldn't find any Nessie config file, are you sure you are using Nessie?

From what I could see, you are trying to mix Node and Deno which is not a good idea. I have an example of a server at https://github.com/halvardssm/ms-auth-user-role. It is not complete by any means, but it should be a good indication on how to start 😄

bramirez96 commented 3 years ago

Ah sorry, it wasn't working and I remove the nessie config in favor of using Knex in a node shell only to run migrations (my bad I forgot 😅). I want to move away from it and get Nessie working but would using Node only for migrations be an issue as they're not runtime scripts? I'll take a look at your example server, thank you!

halvardssm commented 3 years ago

I made a template repo with some code which should be up to date https://github.com/halvardssm/deno-rest-api 🎉