NavigationContentFooter
Jump toSuggest an edit

Solving connection errors

Reviewed on 07 February 2024Published on 07 February 2024

FATAL: password authentication failed for user

Problem

The error message below appears when trying to connect to the Serverless SQL Database:

FATAL: password authentication failed for user "example-fafb-4c6c-a406-911d9675a703"

Cause

You either used the wrong password/IAM secret key, or the wrong username/IAM user ID/application ID.

Solution

Make sure that you use the correct user/application ID and secret key combination.

FATAL: principal does not have permission to access database

Problem

The error message below appears when trying to connect to the Serverless SQL Database:

FATAL: principal example-fafb-4c6c-a406-911d9675a703 does not have permission to access database example-a2ea-4f6e-bbe5-791a1b6905ff

Cause

The IAM principal (user or application) does not have the necessary permissions to connect the database.

Solution

Create a new IAM policy or update an existing one to grant one of the following permissions sets to the user or application:

  • ServerlessSQLDatabaseReadOnly
  • ServerlessSQLDatabaseReadWrite
  • ServerlessSQLDatabaseFullAccess

Database hostname wasn’t sent to server

Problem

The error message below appears when trying to connect to the Serverless SQL Database:

Error: pq: Database hostname wasn't sent to server

Cause

This error happens when the SQL client you are using does not support the TLS Server Name Indication (SNI) feature.

Solution

  • If you are using a third-party tool or library which allows you to input a connection string or optional connection parameters, add ?options=databaseid%3D{databaseid} at the end of your connection string:

    "postgresql://{username}:{password}@{host}:5432/{databasename}?sslmode=require&options=databaseid%3D{databaseid}"

    Or

    terraform {
    backend "pg" {
    conn_str = "postgresql://{username}:{password}@{host}:5432/{databasename}?sslmode=require&options=databaseid%3D{databaseid}"
    }
    required_providers {
    scaleway = {
    source = "scaleway/scaleway"
    }
    }
    required_version = ">= 0.13"
    }
  • If you cannot modify the connection string or optional connection parameters, upgrade or change your client library. Refer to the table below for the most common libraries and tools supporting SNI.

    LanguageLibrary / ToolSNI supportWorkaround to Partial Support
    Nodejsnode-postgresYes
    Nodejspostgres.jsYes
    Pythonpsycopg2Yes
    PythonSQLAlchemyYes
    JavapgjdbcYes
    Golib/pqPartialUpgrade lib/pq to v1.10.7, which supports SNI.
    DartpostgresYes
    N/ApsqlYes
    N/ApgcliYes
    N/ApgAdminYes
    N/ADBeaverYes
    N/APostico 2Yes
    N/AIntelliJ (SQL Module)Yes
    N/AnavicatNo
    N/AStitchNo
    N/ATerraformNoTerraform includes an older lib/pq version (v1.10.3) which doesn’t support SNI.
Docs APIScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCarreer
© 2023-2024 – Scaleway