Skip to content

"hydra clients create" keeps saying "cannot connect" but throws an not null constraint exception #1697

@nhh

Description

@nhh

Describe the bug

Running "hydra clients create"

Running:

docker-compose exec hydra \
    hydra clients create \
    --endpoint http://127.0.0.1:4445 \
    --id $ID \
    --secret $SECRET \
    --grant-types authorization_code,refresh_token \
    --response-types code,id_token \
    --scope openid,offline \
    --callbacks http://127.0.0.1:4446/callback \
    --token-endpoint-auth-method none

I 've also run this with the ip of my local machine (192.168.2.219), with mounted ports.

The client keeps saying it cannot connect to the given endpoint.

I also see an exception being thrown within hydra saying it cannot insert things into the database because "metadata" is null.

Reproducing the bug

Steps to reproduce the behavior:

  1. Run hydra v. 1.0.0
  2. Migrate Database
  3. Run the hydra clients create command

Server logs

...STATEMENT:  INSERT INTO hydra_client (id, client_name, client_secret, redirect_uris, grant_types, response_types, scope, owner, policy_uri, tos_uri, client_uri, subject_type, logo_uri, contacts, client_secret_expires_at, sector_identifier_uri, jwks, jwks_uri, token_endpoint_auth_method, request_uris, request_object_signing_alg, userinfo_signed_response_alg, allowed_cors_origins, audience, updated_at, created_at, frontchannel_logout_uri, frontchannel_logout_session_required, post_logout_redirect_uris, backchannel_logout_uri, backchannel_logout_session_required) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31)
hydra_1          | time="2020-01-19T18:36:57Z" level=error msg="An error occurred while handling a request" code=500 debug= details="map[]" error="pq: null value in column \"metadata\" violates not-null constraint" reason= request-id= status= trace=..."
Config file not found because "Config File ".hydra" Not Found in "[/]""
You should not provide secrets using command line flags, the secret might leak to bash history and similar systems
Unable to connect to "http://127.0.0.1:4445/clients", unexpected HTTP error status code: 500\nUnable to connect: http: ContentLength=460 with Body length 0
Unable to connect: http: ContentLength=460 with Body length 0

Server configuration

version: "3.7"
services:
  dbdev:
    image: "postgres:11"
    ports:
      - "5432:5432"
    environment:
      - "POSTGRES_PASSWORD=postgres"
      - "POSTGRES_USER=postgres"
      - "POSTGRES_DB=postgres"
  hydra:
    image: "oryd/hydra:v1.0.0"
    environment:
      - "URLS_SELF_ISSUER=http://127.0.0.1:4444"
      - "URLS_CONSENT=http://127.0.0.1:4200/consent"
      - "URLS_LOGIN=http://127.0.0.1:4200/login"
      - "URLS_LOGOUT=http://127.0.0.1:4200/logout"
      - "DSN=postgres://hola:hola@hydradb:5432/holadb?sslmode=disable"
      - "SECRETS_SYSTEM=youReallyNeedToChangeThis"
      - "OIDC_SUBJECT_TYPES_SUPPORTED=public,pairwise"
      - "OIDC_SUBJECT_TYPE_PAIRWISE_SALT=youReallyNeedToChangeThis"
    ports:
      - "4444:4444"
      - "4445:4445"
      - "4446:4446"
      - "5555:5555"
    command: serve all --dangerous-force-http
    depends_on:
      - hydra-migrate
  hydradb:
    image: "postgres:11"
    environment:
      - "POSTGRES_PASSWORD=hola"
      - "POSTGRES_USER=hola"
      - "POSTGRES_DB=holadb"
    ports:
      - "5433:5432"
  hydra-migrate:
    image: oryd/hydra:latest
    environment:
      - "DSN=postgres://hola:hola@hydradb:5432/holadb?sslmode=disable"
    command:
      migrate sql -e --yes
    restart: on-failure

Expected behavior

Hydra creates an Oauth2 Client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions