Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

"Error: Invalid Prisma endpoint provided" when using docker-compose to deploy a server alongside prisma server #3367

Closed
n2ctech opened this issue Oct 24, 2018 · 4 comments
Labels
status/on-hold This issue is on hold.

Comments

@n2ctech
Copy link

n2ctech commented Oct 24, 2018

Describe the bug

When using docker-compose to deploy a server (e.g. Apollo Server or graphql yoga) talking to prisma server, it is not possible to reference the prisma server container by its name because of string validation in prisma-binding module :
/app/node_modules/prisma-binding/dist/Prisma.js:44
throw new Error("Invalid Prisma endpoint provided: " + endpoint);

To Reproduce

Consider a docker-compose file:

version: "3"
services:
  prisma:
    image: prismagraphql/prisma:1.19
    restart: always
    ports:
      - 4466:4466
    environment:
      PRISMA_CONFIG: |
        port: 4466
        managementApiSecret: xxxxx
        databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: postgres
            password: postgres
            migrations: true
  postgres:
    image: postgres:10.5
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes:
      - postgres:/var/lib/postgresql/data
  server:
    build:
      dockerfile: Dockerfile.dev
      context: .
    volumes:
      - /app/node_modules
      - ./:/app
    environment:
      - PRISMA_MANAGEMENT_API_SECRET=xxxxx
      - APP_SECRET=xxxxxx
      - PRISMA_URL=prisma
      - PRISMA_SECRET=xxxxx
volumes:
  postgres:

the graphql server running in the server container will try initialise the prisma binding like so :

module.exports = {
  prismaBinding: new Prisma({
    typeDefs,
    endpoint: process.env.PRISMA_URL,
    secret: process.env.PRISMA_SECRET
  })
};

When running docker-compose up this will throw an error when the server image is built and starts running : Error: Invalid Prisma endpoint provided: prisma
This is because it expects the prisma endpoint to start with http://

When deploying to a kubernetes cluster I am experiencing the same issue because the ClusterIP service name for my prisma server pod doesn't start with "http://". Hence the server pod can't talk to prisma server inside the cluster because it crashes with the same error.

Expected behavior
I should be able to take advantage of docker-compose networking tooling with prisma (a container can reference another container's IP address using its name).
Referencing the prisma server from another service by its name (e.g. "prisma") should work.
Idem in k8s when referencing prisma by its service name from another pod.

@n2ctech n2ctech changed the title Invalid Prisma endpoint provided when using docker-compose to deploy a server alongside prisma server "Error: Invalid Prisma endpoint provided" when using docker-compose to deploy a server alongside prisma server Oct 24, 2018
@divyenduz divyenduz added the status/on-hold This issue is on hold. label Nov 5, 2018
@divyenduz
Copy link
Contributor

@n2ctech : Thanks for raising this issue and all the details, can you please move it to prisma-binding https://github.com/prisma/prisma-binding repository?

Thanks!

@n2ctech
Copy link
Author

n2ctech commented Nov 6, 2018

done @divyenduz , closing this one

@n2ctech n2ctech closed this as completed Nov 6, 2018
@divyenduz
Copy link
Contributor

@n2ctech : Please link that issue here as well 🙏

@n2ctech
Copy link
Author

n2ctech commented Nov 6, 2018

moved to prisma-labs/prisma-binding#247

@pantharshit00 pantharshit00 added the status/on-hold This issue is on hold. label Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/on-hold This issue is on hold.
Projects
None yet
Development

No branches or pull requests

3 participants