[GH-ISSUE #88] Unable to do connection - invalid port ":xxxx" after host #72

Closed
opened 2026-02-26 21:34:17 +03:00 by kerem · 3 comments
Owner

Originally created by @URBANsUNITED on GitHub (Feb 6, 2025).
Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/88

Hi!

Using latest docker and can't make a connection to my Postgres database:

Error

goose run: cannot parse postgresql://NAME:xxxxxx@postgres:5432/pgbackweb?sslmode=disable: failed to parse as URL (parse "postgresql://NAME:xxxxi?13=0@postgres:5432/pgbackweb?sslmode=disable": invalid port ":xxxx" after host)

My compose file:

services:
  pgbackweb:
    image: eduardolat/pgbackweb:latest
    ports:
      - "8095:8085" # Access the web interface at http://localhost:8085
    volumes:
      - ./backups:/backups # If you only use S3 destinations, you don't need this volume
    environment:
      PBW_ENCRYPTION_KEY: "xxx" # Change this to a strong key
      PBW_POSTGRES_CONN_STRING: "postgresql://NAME:Axxxxxxx=$$?@postgres:5432/pgbackweb?sslmode=disable"
      TZ: "Europe/Berlin" # Set your timezone, optional
#    depends_on:
#      postgres:
#        condition: service_healthy
    networks:
      - postgres
      
networks:
  postgres:
    name: postgres

My password uses $ (shift 4 - dollar sign) , so I know from other postgres connections, I have to do double dollar signs - but even this is not working.

My fault or on programs side?

Thanks

URBANsUNITED

Originally created by @URBANsUNITED on GitHub (Feb 6, 2025). Original GitHub issue: https://github.com/eduardolat/pgbackweb/issues/88 Hi! Using latest docker and can't make a connection to my Postgres database: Error > goose run: cannot parse `postgresql://NAME:xxxxxx@postgres:5432/pgbackweb?sslmode=disable`: failed to parse as URL (parse "**postgresql://NAME:xxxxi?13=0@postgres:5432/pgbackweb?sslmode=disable": invalid port ":xxxx" after host)** My compose file: ``` services: pgbackweb: image: eduardolat/pgbackweb:latest ports: - "8095:8085" # Access the web interface at http://localhost:8085 volumes: - ./backups:/backups # If you only use S3 destinations, you don't need this volume environment: PBW_ENCRYPTION_KEY: "xxx" # Change this to a strong key PBW_POSTGRES_CONN_STRING: "postgresql://NAME:Axxxxxxx=$$?@postgres:5432/pgbackweb?sslmode=disable" TZ: "Europe/Berlin" # Set your timezone, optional # depends_on: # postgres: # condition: service_healthy networks: - postgres networks: postgres: name: postgres ``` My password uses $ (shift 4 - dollar sign) , so I know from other postgres connections, I have to do double dollar signs - $$ but even this is not working. My fault or on programs side? Thanks URBANsUNITED
kerem closed this issue 2026-02-26 21:34:18 +03:00
Author
Owner

@eduardolat commented on GitHub (Feb 6, 2025):

Can you please test the compose.yaml from the README to verify that everything works correctly?

<!-- gh-comment-id:2640224429 --> @eduardolat commented on GitHub (Feb 6, 2025): Can you please test the compose.yaml from the README to verify that everything works correctly?
Author
Owner

@URBANsUNITED commented on GitHub (Feb 7, 2025):

Hi!
After lots of tests I can confirm that the problem exists also in the original setup!
But I also found a solution.
The password must be encoded to URL-encoded format.
Ex.
Test12=%! = Test12%3D%25%21
Use this for easy
https://www.urlencoder.org/

Btw. The PBW_POSTGRES_CONN_STRING: "postgresql://Name:Pass@postgres:5432?sslmode=disable" works also without naming a database
It would be great to select the existing databases from the dashboard without knowing the correct names. Choose from a list and simply select all databases you'll like to backup.

URBANsUNITED

<!-- gh-comment-id:2642414877 --> @URBANsUNITED commented on GitHub (Feb 7, 2025): Hi! After lots of tests I can confirm that the problem exists also in the original setup! But I also found a solution. The password must be encoded to URL-encoded format. Ex. Test12=%! = Test12%3D%25%21 Use this for easy https://www.urlencoder.org/ Btw. The PBW_POSTGRES_CONN_STRING: "postgresql://Name:Pass@postgres:5432?sslmode=disable" works also without naming a database It would be great to select the existing databases from the dashboard without knowing the correct names. Choose from a list and simply select all databases you'll like to backup. URBANsUNITED
Author
Owner

@eduardolat commented on GitHub (Feb 22, 2025):

Hi, you're right that the issue with your PostgreSQL connection string is related to percent encoding, especially when special characters like the dollar sign ($) are included in passwords. This behavior is well-documented and is not specifically related to PG Back Web.

This issue is also duplicated in another GitHub issue, which you can find here: Issue #3.

For your reference, here are some useful links:


Additionally, it's advisable to always explicitly specify the database name in your connection string to avoid any undesirable behaviors. For an example of such behaviors, you can refer to this Discord thread:

https://discord.com/channels/1269791103536599112/1318507751193837598.

In future versions, there will be validation to ensure that a database name is always included.

<!-- gh-comment-id:2676339029 --> @eduardolat commented on GitHub (Feb 22, 2025): Hi, you're right that the issue with your PostgreSQL connection string is related to percent encoding, especially when special characters like the dollar sign ($) are included in passwords. This behavior is well-documented and is not specifically related to PG Back Web. This issue is also duplicated in another GitHub issue, which you can find here: [Issue #3](https://github.com/eduardolat/pgbackweb/issues/3). For your reference, here are some useful links: - PostgreSQL connection string documentation: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS - Percent encoding: https://datatracker.ietf.org/doc/html/rfc3986#section-2.1 --- Additionally, it's advisable to always explicitly specify the database name in your connection string to avoid any undesirable behaviors. For an example of such behaviors, you can refer to this Discord thread: https://discord.com/channels/1269791103536599112/1318507751193837598. In future versions, there will be validation to ensure that a database name is always included.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#72
No description provided.