Prisma1: Can't deploy app created with `prisma init` locally

Created on 21 Jun 2018  Â·  10Comments  Â·  Source: prisma/prisma1

Quick start guide / prisma init xxx + prisma deploy not working.

To Reproduce

npm install -g prisma
prisma init hello-world
cd hello-world

docker-machine create trying-prisma
eval "$(docker-machine env trying-prisma)" && docker-compose up

The docker-compose up results in the error/output bellow, with these errors:

  • prisma_1 | com.prisma.config.InvalidConfiguration: Expected uri to be non-empty
  • ERROR: null value in column "lastPinged" violates not-null constraint

Full output:

Creating network "api_default" with the default driver
Creating volume "api_postgres" with default driver
Pulling prisma (prismagraphql/prisma:1.10)...
1.10: Pulling from prismagraphql/prisma
ff3a5c916c92: Pull complete
b2573fe715ab: Pull complete
6af743f153ed: Pull complete
18e8c64bc75c: Pull complete
b5ae73a6fa0a: Pull complete
e0a324636a6c: Pull complete
5fe836af413d: Pull complete
d9b27ae39805: Pull complete
5accab8f54ac: Pull complete
Digest: sha256:29dd2e76d48385386abc8cba7d15b13bfa583c11491232ca62ea3fb7fe5153f3
Status: Downloaded newer image for prismagraphql/prisma:1.10
Pulling postgres (postgres:)...
latest: Pulling from library/postgres
f2aa67a397c4: Pull complete
3f47e9dfd161: Pull complete
365e1eb16a96: Pull complete
c537ee5f45d2: Pull complete
52e33f5a09fb: Pull complete
e48edfb2fccd: Pull complete
e2ea3d468f97: Pull complete
cf6364e94865: Pull complete
1a338d562303: Pull complete
a27c9ce6f0ca: Pull complete
c180157ca381: Pull complete
2111989d7706: Pull complete
b9690b23a065: Pull complete
5ac41d115dfe: Pull complete
Digest: sha256:d9c44f9fc460dd8962c388eacf88a0e252b858ccdf33bc223f68112617e81fc9
Status: Downloaded newer image for postgres:latest
Creating api_prisma_1   ... done
Creating api_postgres_1 ... done
Attaching to api_postgres_1, api_prisma_1
postgres_1  | The files belonging to this database system will be owned by user "postgres".
postgres_1  | This user must also own the server process.
postgres_1  |
postgres_1  | The database cluster will be initialized with locale "en_US.utf8".
postgres_1  | The default database encoding has accordingly been set to "UTF8".
postgres_1  | The default text search configuration will be set to "english".
postgres_1  |
postgres_1  | Data page checksums are disabled.
postgres_1  |
postgres_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1  | creating subdirectories ... ok
postgres_1  | selecting default max_connections ... 100
postgres_1  | selecting default shared_buffers ... 128MB
postgres_1  | selecting dynamic shared memory implementation ... posix
postgres_1  | creating configuration files ... ok
postgres_1  | running bootstrap script ... ok
postgres_1  | performing post-bootstrap initialization ... ok
postgres_1  | syncing data to disk ... ok
postgres_1  |
postgres_1  | WARNING: enabling "trust" authentication for local connections
postgres_1  | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1  | --auth-local and --auth-host, the next time you run initdb.
postgres_1  |
postgres_1  | Success. You can now start the database server using:
postgres_1  |
postgres_1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1  |
postgres_1  | waiting for server to start....2018-06-21 13:32:03.343 UTC [38] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1  | 2018-06-21 13:32:03.366 UTC [39] LOG:  database system was shut down at 2018-06-21 13:32:03 UTC
postgres_1  | 2018-06-21 13:32:03.371 UTC [38] LOG:  database system is ready to accept connections
postgres_1  |  done
postgres_1  | server started
postgres_1  | CREATE DATABASE
postgres_1  |
postgres_1  | CREATE ROLE
postgres_1  |
postgres_1  |
postgres_1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
postgres_1  |
postgres_1  | 2018-06-21 13:32:03.913 UTC [38] LOG:  received fast shutdown request
postgres_1  | waiting for server to shut down....2018-06-21 13:32:03.914 UTC [38] LOG:  aborting any active transactions
postgres_1  | 2018-06-21 13:32:03.920 UTC [38] LOG:  worker process: logical replication launcher (PID 45) exited with exit code 1
postgres_1  | 2018-06-21 13:32:03.921 UTC [40] LOG:  shutting down
postgres_1  | 2018-06-21 13:32:03.931 UTC [38] LOG:  database system is shut down
postgres_1  |  done
postgres_1  | server stopped
postgres_1  |
postgres_1  | PostgreSQL init process complete; ready for start up.
postgres_1  |
postgres_1  | 2018-06-21 13:32:04.046 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_1  | 2018-06-21 13:32:04.047 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_1  | 2018-06-21 13:32:04.048 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1  | 2018-06-21 13:32:04.073 UTC [65] LOG:  database system was shut down at 2018-06-21 13:32:03 UTC
postgres_1  | 2018-06-21 13:32:04.076 UTC [1] LOG:  database system is ready to accept connections
prisma_1    | com.prisma.config.InvalidConfiguration: Expected uri to be non-empty
prisma_1    |   at com.prisma.config.ConfigLoader$.extractString(ConfigLoader.scala:239)
prisma_1    |   at com.prisma.config.ConfigLoader$.$anonfun$readDbWithConnectionString$1(ConfigLoader.scala:133)
prisma_1    |   at scala.util.Try$.apply(Try.scala:209)
prisma_1    |   at com.prisma.config.ConfigLoader$.readDbWithConnectionString(ConfigLoader.scala:129)
prisma_1    |   at com.prisma.config.ConfigLoader$.$anonfun$convertToConfig$2(ConfigLoader.scala:117)
prisma_1    |   at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
prisma_1    |   at scala.collection.immutable.Map$Map1.foreach(Map.scala:120)
prisma_1    |   at scala.collection.TraversableLike.map(TraversableLike.scala:234)
prisma_1    |   at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
prisma_1    |   at scala.collection.AbstractTraversable.map(Traversable.scala:104)
prisma_1    |   at com.prisma.config.ConfigLoader$.convertToConfig(ConfigLoader.scala:115)
prisma_1    |   at com.prisma.config.ConfigLoader$.$anonfun$tryLoadString$1(ConfigLoader.scala:63)
prisma_1    |   at scala.util.Try$.apply(Try.scala:209)
prisma_1    |   at com.prisma.config.ConfigLoader$.tryLoadString(ConfigLoader.scala:63)
prisma_1    |   at com.prisma.config.ConfigLoader$.$anonfun$tryLoad$6(ConfigLoader.scala:60)
prisma_1    |   at scala.util.Success.flatMap(Try.scala:247)
prisma_1    |   at com.prisma.config.ConfigLoader$.tryLoad(ConfigLoader.scala:60)
prisma_1    |   at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:39)
prisma_1    |   at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:39)
prisma_1    |   at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:15)
prisma_1    |   at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:12)
prisma_1    |   at scala.Function0.apply$mcV$sp(Function0.scala:34)
prisma_1    |   at scala.Function0.apply$mcV$sp$(Function0.scala:34)
prisma_1    |   at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
prisma_1    |   at scala.App.$anonfun$main$1$adapted(App.scala:76)
prisma_1    |   at scala.collection.immutable.List.foreach(List.scala:389)
prisma_1    |   at scala.App.main(App.scala:76)
prisma_1    |   at scala.App.main$(App.scala:74)
prisma_1    |   at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:12)
prisma_1    |   at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala)
postgres_1  | 2018-06-21 13:32:04.786 UTC [72] ERROR:  database "prisma" already exists
postgres_1  | 2018-06-21 13:32:04.786 UTC [72] STATEMENT:  CREATE DATABASE "prisma"
prisma_1    | Obtaining exclusive agent lock...
prisma_1    | Obtaining exclusive agent lock... Successful.
prisma_1    | Deployment worker initialization complete.
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] ERROR:  null value in column "lastPinged" violates not-null constraint
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] DETAIL:  Failing row contains (2b3068c8-dda7-4013-9e64-00fa40f03801, null).
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] STATEMENT:  insert into "TelemetryInfo" ("id","lastPinged")  values ($1,$2)
prisma_1    | Initializing workers...
prisma_1    | Successfully started 1 workers.
prisma_1    | Server running on :4466

Final Step:

Even so it says prisma_1 | Server running on :4466, when I try to prisma deploy I get:

 â–¸    Could not connect to server at http://localhost:4466. Please check if your server is running.

Expected behavior
compose up and prisma deploy commands should run just fine.

Versions (please complete the following information):

  • OS: macOS Sierra 10.12.6
  • prisma CLI: prisma/1.10.2 (darwin-x64) node-v10.2.1
  • Prisma Server: Not sure how to check

    • Docker version: 18.05.0-ce, build f150324

    • docker-machine version: 0.15.0, build b48dc28

    • docker-compose version: 1.21.2, build unknown

Additional context

Configuration files (all generated by prisma init):

# datamodel.graphql
type User{
  id: ID! @unique
  name: String!
}
# prisma.yml
endpoint: http://localhost:4466
datamodel: datamodel.graphql
# docker-compose.graphql
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.8
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: prisma
            password: prisma
            migrations: true
  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: prisma
      POSTGRES_PASSWORD: prisma
    volumes:
      - postgres:/var/lib/postgresql/data
volumes:
  postgres:
bu1-repro-available

Most helpful comment

@divyenduz I'm pretty sure I tested with the container IP directly as well, multiple times. And it didn't work.

However I just uninstalled + reinstalled everything again, one more time. Even node, npm, docker stuff etc. Then did the whole process one final time before giving up. And it worked! 🎉

But only after changing the endpoint in prisma.yml to my docker machine IP -- localhost didn't seem to reach the container.

docker-machine ip default

Thanks for all the answers.

All 10 comments

@arboleya : You can check your prisma server by looking at this part of your docker-compose.yml file

prisma:
image: prismagraphql/prisma:1.8

As observed, you are on an older version of server, can you please replace it with 1.10 like this?

prisma:
image: prismagraphql/prisma:1.10

and try it again to see if it works?

Thanks!

I have the same problem working with v.1.10

@divyenduz I tried with 1.8 and 1.10 and, as @maginkgo pointed out as well, the error persists.

@arboleya and @maginkgo Thanks for the details. However, I was still unable to replicate this. I tried it with docker-machine and it worked.

screen shot 2018-06-26 at 10 44 11 am

In your descriptions the first error, is just a warning, it will be removed soon.
prisma_1 | com.prisma.config.InvalidConfiguration: Expected uri to be non-empty.

I also see the second one in logs but I am still able to deploy, i.e. that is also just a warning.
ERROR: null value in column "lastPinged" violates not-null constraint

But did you try to change the endpoint in prisma.yml to docker-machine IP and tried a deployment? For me the deployment worked.

Please confirm. Thanks.

postgres_1  | 2018-06-21 13:32:04.786 UTC [72] ERROR:  database "prisma" already exists
postgres_1  | 2018-06-21 13:32:04.786 UTC [72] STATEMENT:  CREATE DATABASE "prisma"
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] ERROR:  null value in column "lastPinged" violates not-null constraint
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] DETAIL:  Failing row contains (2b3068c8-dda7-4013-9e64-00fa40f03801, null).
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] STATEMENT:  insert into "TelemetryInfo" ("id","lastPinged")  values ($1,$2)

It looks like you tried to connect Prisma to your database before which only went through halfway. Clean up your database completely (the prisma database), and try again.

@rohmanhm, the "Expected uri to be non-empty" error is harmless and should not stop you from running Prisma. If this is the case however, please create a new issue as this issue is more likely about these error messages:

postgres_1  | 2018-06-21 13:32:04.786 UTC [72] ERROR:  database "prisma" already exists
postgres_1  | 2018-06-21 13:32:04.786 UTC [72] STATEMENT:  CREATE DATABASE "prisma"
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] ERROR:  null value in column "lastPinged" violates not-null constraint
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] DETAIL:  Failing row contains (2b3068c8-dda7-4013-9e64-00fa40f03801, null).
postgres_1  | 2018-06-21 13:32:07.054 UTC [93] STATEMENT:  insert into "TelemetryInfo" ("id","lastPinged")  values ($1,$2)

and not about "Expected uri to be non-empty".

Sorry, my bad.
I wrote my comment before @divyenduz 😄, But posted after @divyenduz comment.

To anyone who gets an error message

com.prisma.config.InvalidConfiguration: Expected uri to be non-empty

Don't worry it just a warning message. Your app will still work properly.

I can confirm that all the issues mentioned in this thread are non-fatal and it is still possible to deploy to this prisma server.

Closing this one, please re-open if the deploy does not work for you. Thanks.

@divyenduz I'm pretty sure I tested with the container IP directly as well, multiple times. And it didn't work.

However I just uninstalled + reinstalled everything again, one more time. Even node, npm, docker stuff etc. Then did the whole process one final time before giving up. And it worked! 🎉

But only after changing the endpoint in prisma.yml to my docker machine IP -- localhost didn't seem to reach the container.

docker-machine ip default

Thanks for all the answers.

docker-machine ip default
the ip address you got, put it instead of localhost in the prisma.yml file

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomaswright picture thomaswright  Â·  3Comments

sedubois picture sedubois  Â·  3Comments

AlessandroAnnini picture AlessandroAnnini  Â·  3Comments

jannone picture jannone  Â·  3Comments

notrab picture notrab  Â·  3Comments