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

Credentials Overwrite does not work for Postgres node #4611

Closed
kamalptw opened this issue Nov 15, 2022 · 5 comments · Fixed by #4675
Closed

Credentials Overwrite does not work for Postgres node #4611

kamalptw opened this issue Nov 15, 2022 · 5 comments · Fixed by #4675

Comments

@kamalptw
Copy link

kamalptw commented Nov 15, 2022

Describe the bug
After overwriting credentials globally for Postgres node, when adding and saving Postgres credentials, we get an error connecting to 127.0.0.1:5432. Notice that the host and port are the default ones and not the ones we overwrote.

To Reproduce
Steps to reproduce the behavior:

As a self hosted instance, we would like to hide postgres connection parameters from the users who are accessing the instance. We do this using CREDENTIALS_OVERWRITE_ENDPOINT variable. We make an API call like so
curl -H "Content-Type: application/json" --data @credentials.json <instance-url>/<CREDENTIALS_OVERWRITE_ENDPOINT>
This returns a {success: true} meaning the credential was successfully overwritten for postgres

After this

  1. Go to credentials page
  2. Click on Add credential
  3. Select Postgres
  4. Without making any changes, just hit Save.
  5. See the error connecting to 127.0.0.1:5432

Expected behavior
The expectation is that the overwritten credentials should be used when adding a new credential rather than the default host, database, password and port.

Environment (please complete the following information):

  • OS: AWS Ec2 Linux
  • n8n Version: Version 0.202.1
  • Database system: Postgres
  • Operation mode: Own
  • Deployment: via docker-compose

Additional context

@kamalptw
Copy link
Author

@janober @netroy @ivov
Any help here would be much appreciated. Thank you.

@netroy
Copy link
Member

netroy commented Nov 21, 2022

@kamalptw I'm unable to reproduce this by using CREDENTIALS_OVERWRITE_ENDPOINT or CREDENTIALS_OVERWRITE_DATA.
Can you please check that credentials.json looks something like this:

{"postgres":{"user":"<USER>","password":"<PASSWORD>"}}

Also, the endpoint can only be called once. So, if you make a call to the endpoint with {}, followed by a second call with valid data, it won't work.

@netroy
Copy link
Member

netroy commented Nov 21, 2022

@kamalptw i managed to find the issue, and the above PR should fix it ^

@kamalptw
Copy link
Author

@netroy Thanks so much. I'll keep an eye out for when this gets released!

@netroy netroy added the Upcoming Release Will be part of the upcoming release label Nov 24, 2022
@janober
Copy link
Member

janober commented Nov 24, 2022

Fix got released with n8n@0.204.0

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

Successfully merging a pull request may close this issue.

3 participants