stacker.news icon indicating copy to clipboard operation
stacker.news copied to clipboard

'docker-compose up --build' ends in error

Open liviu-ln opened this issue 2 years ago • 2 comments

The displayed error is:

app | prisma:error app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app | app | Validation Error Count: 1 app | event - build page: /500 app | wait - compiling... app | event - compiled successfully app | error - ApolloError: app | Invalid prisma.queryRaw() invocation: app | app | app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app | app | Validation Error Count: 1 app | at new ApolloError (/app/node_modules/@apollo/client/errors/errors.cjs.js:34:28) app | at /app/node_modules/@apollo/client/core/core.cjs.js:1575:47 app | at both (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:981:53) app | at /app/node_modules/@apollo/client/utilities/utilities.cjs.js:974:72 app | at new Promise () app | at Object.then (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:974:24) app | at Object.next (/app/node_modules/@apollo/client/utilities/utilities.cjs.js:982:49) app | at notifySubscription (/app/node_modules/zen-observable/lib/Observable.js:135:18) app | at onNotify (/app/node_modules/zen-observable/lib/Observable.js:179:3) app | at SubscriptionObserver.next (/app/node_modules/zen-observable/lib/Observable.js:235:7) { app | graphQLErrors: [ app | Error: app | Invalid prisma.queryRaw() invocation: app |
app |
app | error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://. app | --> schema.prisma:6 app | | app | 5 | provider = "postgresql" app | 6 | url = env("DATABASE_URL") app | | app |
app | Validation Error Count: 1 app | at cb (/app/node_modules/@prisma/client/runtime/index.js:33822:17) app | at runMicrotasks () app | at processTicksAndRejections (internal/process/task_queues.js:95:5) app | at async items (webpack-internal:///./api/resolvers/item.js:253:25) app | at async Promise.all (index 0) { app | locations: [], app | path: [Array] app | } app | ], app | clientErrors: [], app | networkError: null, app | extraInfo: undefined, app | page: '/' app | }

liviu-ln avatar Sep 14 '22 12:09 liviu-ln

Looks to be an issue with older versions of docker-compose. https://stackoverflow.com/questions/71736148/prisma-error-validating-datasource-db-the-url-must-start-with-the-protocol

My version is 1.25.0 and as recommended by the StackOverflow article, just removing the quotes made it work:

-DATABASE_URL="postgresql://sn:password@db:5432/stackernews?schema=public" +DATABASE_URL=postgresql://sn:password@db:5432/stackernews?schema=public

liviu-ln avatar Sep 14 '22 12:09 liviu-ln

Thanks! I need to update the docker environment

huumn avatar Sep 14 '22 14:09 huumn