Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid password characters can break the connection string #229

Closed
Alfredo-Delgado opened this issue Aug 8, 2018 · 4 comments
Closed

Valid password characters can break the connection string #229

Alfredo-Delgado opened this issue Aug 8, 2018 · 4 comments

Comments

@Alfredo-Delgado
Copy link

Steps to reproduce

In ./config/default.json, set postgres to a connection string like postgres://database_user:abc1d-e?=F$GhI2j@localhost:5432/target_database and try to start the app.

Expected behavior

Successful DB connection.

Actual behavior

It seems that the connection string parsing in sequelize is brittle.

error: Unhandled Rejection at: Promise {"_bitField":18087936,"_fulfillmentHandler0":{"name":"SequelizeHostNotFoundError","parent":{"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"database_user","host":"database_user","port":5432},"original":{"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"database_user","host":"database_user","port":5432}}}

System configuration

Module version: [email protected]
NodeJS version: v8.11.3
Operating System: macOS 10.13.6

I propose that we also accept an object like

"postgres": {
  "host": "",
  "port": "",
  "username": "",
  "password": ""
  "database": ""
}

I guess this is something I could implement in the generators that output default.json and src/sequelize.js?

@daffl
Copy link
Member

daffl commented Aug 8, 2018

encodeURIComponent should help here.

@Alfredo-Delgado
Copy link
Author

I guess I should move this to https://github.com/feathersjs/generator-feathers, too.

@daffl
Copy link
Member

daffl commented Aug 15, 2018

@ghost
Copy link

ghost commented Oct 22, 2019

I received this same error messa when I edited my src/models/users.model.js and described one of my fields as

    note: {
      type: DataTypes.TEXT(256), // <== the error was this (256)
      allowNull: true
    }

It seems the fact I declared the size of the field wasn't well accepted by sequelize and the error message was

info: Feathers application started on http://localhost:3030
error: Unhandled Rejection at: Promise {"_bitField":18087936,"_fulfillmentHandler0":{}}

When I removed the (256) it worked fine again.

Curiously it accepts a size specification for all other data types. I'am using MariaDB, which I am not very familiar with, and don't know if this is characteristic to this data type or just a bug. I'll investigate further another time. Have to deliver a lot this week and this is not stimulating to research activities.

I hope this helps to bring some light to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants