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

Database connection string with postgresql protocol assumes MongoDB #7687

Closed
pmmlo opened this issue Nov 10, 2021 · 6 comments · Fixed by #7757
Closed

Database connection string with postgresql protocol assumes MongoDB #7687

pmmlo opened this issue Nov 10, 2021 · 6 comments · Fixed by #7757
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@pmmlo
Copy link

pmmlo commented Nov 10, 2021

New Issue Checklist

Issue Description

Developers using PostgreSQL can only use a URI with the prefix "postgres:" when "postgresql:" is also commonly used.

Steps to reproduce

  1. Set env var PARSE_SERVER_DATABASE_URI to a URI string starting with "postgresql://..."
  2. There will be a "MongoParseError" as it fallsback to MongoDB.

Actual Outcome

"MongoParseError: Invalid connection string"

Expected Outcome

Should validate as a PostgreSQL URI.

Environment

Node v17.0.1

Server

  • Parse Server version: 5.0.0-beta.1
  • Operating system: macOS 12.0.1
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): Postgres
  • Database version: Postgres 14.0.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): n/a
  • SDK version: n/a

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 10, 2021

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@cbaker6
Copy link
Contributor

cbaker6 commented Nov 10, 2021

Seems like this could be added.

For reference: https://www.postgresql.org/docs/current/libpq-connect.html

Parse Server connects to Postgres using pg-promise->node-postgres. Reference uri: https://node-postgres.com/features/connecting

@mtrezza mtrezza changed the title Bug: Postgresql prefix URI fallsback to MongoDB Postgresql prefix URI fallsback to MongoDB Nov 10, 2021
@mtrezza
Copy link
Member

mtrezza commented Nov 10, 2021

Classified this as a bug as the Parse Server docs say:

The postgres database adapter will be automatically loaded when you pass a valid postgres URL, for example: postgres://localhost:5432.

A "valid postgres URL" includes the postgresql protocol, see docs:

The URI scheme designator can be either postgresql:// or postgres://

So it should work with either one. Severity low, as the workaround is to use the postgres protocol instead.

@mtrezza mtrezza added severity:low type:bug Impaired feature or lacking behavior that is likely assumed and removed type:improvement labels Nov 10, 2021
@mtrezza mtrezza changed the title Postgresql prefix URI fallsback to MongoDB Database connection string with postgresql protocol assumed MongoDB Nov 10, 2021
@mtrezza mtrezza changed the title Database connection string with postgresql protocol assumed MongoDB Database connection string with postgresql protocol assumes MongoDB Nov 10, 2021
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-alpha.15

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jan 2, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.10

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Mar 15, 2022
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants