Introduction
Trying to create my own minimalistic RW App, I took the Example Repo, and in order to make it also easy to deploy I followed the section Local Postgres Setup VERY CAREFULLY.
Well, it seems that @rob was right in stating:
Install Postgres? Iβve messed up my Postgres installation so many times, I wish I could just uninstall everything and start over!
I felt the same way a few years back when reading Local Postgres Setup for the first time. Not being lazy and being interested in helping others in a possibly similar situation, I created and published the article How to install PostgreSQL with EDB Installer.
Problem description
I will immediately admit my weakness in this general area (databases), even if this time I run into troubles not with installation, but rather configuration. Here is my problem presented in the form of a screenshot of PgAdmin 4
My database is rw-auth
, and the (default) owner is postgres
. Assuming that I set everything right (.env
file, content of schema.prisma
etc.) running yarn rw dev
results with:
nik$ yarn rw dev
gen | Generating TypeScript definitions and GraphQL schemas...
gen | 42 files generated
api | Building... Took 550 ms
api | Debugger listening on ws://127.0.0.1:18911/54079687-0331-4e22-8348-b1f9e76e61df
api | For help, see: https://nodejs.org/en/docs/inspector
api | Starting API Server...
api | {"level":30,"time":1688331254896,"pid":32363,"hostname":"Nikolajs-MacBook-Pro.local","side":"api","_":["api"],"port":8911,"p":8911,"apiRootPath":"/","rootPath":"/","root-path":"/","api-root-path":"/","$0":"node_modules/@redwoodjs/api-server/dist/index.js","msg":"In configureFastify hook for side: api"}
api | Importing Server Functions...
api | /graphql 764 ms
api | /auth 2 ms
api | ...Done importing in 767 ms
api | Took 823 ms
api | API listening on http://localhost:8911/
api | GraphQL endpoint at /graphql
api | 16:54:15 π undefined undefined Fastify server configuration
api | π Custom
api | {
api | "connectionTimeout": 0,
api | "keepAliveTimeout": 72000,
api | "maxRequestsPerSocket": 0,
api | "requestTimeout": 0,
api | "requestIdHeader": "request-id",
api | "requestIdLogLabel": "reqId",
api | "disableRequestLogging": false,
api | "bodyLimit": 1048576,
api | "caseSensitive": true,
api | "allowUnsafeRegex": false,
api | "ignoreTrailingSlash": false,
api | "ignoreDuplicateSlashes": false,
api | "jsonShorthand": true,
api | "maxParamLength": 100,
api | "onProtoPoisoning": "error",
api | "onConstructorPoisoning": "error",
api | "pluginTimeout": 10000,
api | "http2SessionTimeout": 72000,
api | "exposeHeadRoutes": true
api | }
api | π Custom
api | {
api | "time": 1688331255689,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Fastify server configuration"
api | }
api | 16:54:15 π undefined undefined Registered plugins
api | bound root 810 ms
api | βββ bound _after 5 ms
api | βββ @fastify/url-data 0 ms
api | βββ fastify-raw-body 1 ms
api | βββ bound _after 0 ms
api | βββ bound _after 0 ms
api | βββ bound _after 1 ms
api | βββ bound _after 0 ms
api | βββ bound _after 0 ms
api |
api | π Custom
api | {
api | "time": 1688331255690,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Registered plugins \nbound root 810 ms\nβββ bound _after 5 ms\nβββ @fastify/url-data 0 ms\nβββ fastify-raw-body 1 ms\nβββ bound _after 0 ms\nβββ bound _after 0 ms\nβββ bound _after 1 ms\nβββ bound _after 0 ms\nβββ bound _after 0 ms\n"
api | }
api | 16:54:15 π² undefined undefined Server listening at http://[::]:8911
api | π Custom
api | {
api | "time": 1688331255694,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Server listening at http://[::]:8911"
api | }
web | assets by path static/js/*.js 6.62 MiB
web | asset static/js/app.bundle.js 3.1 MiB [emitted] (name: app) 1 related asset
web | asset static/js/LoginPage.chunk.js 447 KiB [emitted] (name: LoginPage) 1 related asset
web | asset static/js/SignupPage.chunk.js 447 KiB [emitted] (name: SignupPage) 1 related asset
web | asset static/js/ResetPasswordPage.chunk.js 425 KiB [emitted] (name: ResetPasswordPage) 1 related asset
web | asset static/js/ForgotPasswordPage.chunk.js 404 KiB [emitted] (name: ForgotPasswordPage) 1 related asset
web | asset static/js/PostEditPostPage.chunk.js 367 KiB [emitted] (name: PostEditPostPage) 1 related asset
web | asset static/js/PostNewPostPage.chunk.js 366 KiB [emitted] (name: PostNewPostPage) 1 related asset
web | asset static/js/ContactPage.chunk.js 346 KiB [emitted] (name: ContactPage) 1 related asset
web | asset static/js/PostPostsPage.chunk.js 260 KiB [emitted] (name: PostPostsPage) 1 related asset
web | asset static/js/PostPostPage.chunk.js 236 KiB [emitted] (name: PostPostPage) 1 related asset
web | + 5 assets
web | asset favicon.png 1.83 KiB [emitted] [from: public/favicon.png] [copied]
web | asset index.html 456 bytes [emitted]
web | asset robots.txt 24 bytes [emitted] [from: public/robots.txt] [copied]
web | Entrypoint app 3.15 MiB (3.09 MiB) = static/js/runtime-app.bundle.js 51 KiB static/js/app.bundle.js 3.1 MiB 2 auxiliary assets
web | orphan modules 413 KiB [orphan] 116 modules
web | runtime modules 34.3 KiB 19 modules
web | modules by path ../node_modules/ 2.78 MiB 951 modules
web | modules by path ./src/ 198 KiB
web | modules by path ./src/pages/ 104 KiB 14 modules
web | modules by path ./src/components/ 38.5 KiB 10 modules
web | modules by path ./src/*.css 40.4 KiB
web | ./src/scaffold.css 2.88 KiB [built] [code generated]
web | + 3 modules
web | modules by path ./src/*.js 9.96 KiB
web | ./src/App.js 1.78 KiB [built] [code generated]
web | + 2 modules
web | modules by path ./src/layouts/ 4.9 KiB
web | ./src/layouts/BlogLayout/BlogLayout.js 2.99 KiB [built] [code generated]
web | ./src/layouts/PostsLayout/PostsLayout.js 1.91 KiB [built] [code generated]
web | webpack 5.81.0 compiled successfully in 8110 ms
api | 16:54:20 π² undefined undefined incoming request GET xxx /auth?method=getToken
api | π Custom
api | {
api | "time": 1688331260843,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "reqId": "req-1",
api | "req": {
api | "method": "GET",
api | "url": "/auth?method=getToken",
api | "hostname": "localhost:8910",
api | "remoteAddress": "::1",
api | "remotePort": 58184
api | },
api | "msg": "incoming request"
api | }
api | 16:54:20 π² undefined undefined request completed 20ms
api | π Custom
api | {
api | "time": 1688331260864,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "reqId": "req-1",
api | "res": {
api | "statusCode": 200
api | },
api | "msg": "request completed"
api | }
api | 16:54:20 π² undefined undefined incoming request POST xxx /graphql
api | π Custom
api | {
api | "time": 1688331260940,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "reqId": "req-2",
api | "req": {
api | "method": "POST",
api | "url": "/graphql",
api | "hostname": "localhost:8910",
api | "remoteAddress": "::1",
api | "remotePort": 58185
api | },
api | "msg": "incoming request"
api | }
api | 16:54:20 π undefined undefined Parsing request to extract GraphQL parameters
api | π Custom
api | {
api | "time": 1688331260949,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Parsing request to extract GraphQL parameters"
api | }
api | 16:54:20 π undefined undefined Processing GraphQL Parameters
api | π Custom
api | {
api | "time": 1688331260950,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Processing GraphQL Parameters"
api | }
api | 16:54:20 π undefined graphql-server GraphQL execution started: BlogPostsQuery
api | π Custom
api | {
api | "time": 1688331260965,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "GraphQL execution started: BlogPostsQuery"
api | }
api | 16:54:20 π² undefined undefined Starting a postgresql pool with 1 connections.
api | π Custom
api | {
api | "time": 1688331260973,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "prisma": {
api | "clientVersion": "4.13.0"
api | },
api | "timestamp": "2023-07-02T20:54:20.973Z",
api | "target": "quaint::pooled",
api | "msg": "Starting a postgresql pool with 1 connections."
api | }
api | 16:54:20 π¨ undefined undefined
api | Invalid `db.post.findMany()` invocation in
api | /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | β 4 return db.post.findMany(
api | Database `rw-auth` does not exist on the database server at `localhost:5432`.
api | π Custom
api | {
api | "time": 1688331260986,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "prisma": {
api | "clientVersion": "4.13.0"
api | },
api | "timestamp": "2023-07-02T20:54:20.986Z",
api | "target": "post.findMany",
api | "msg": "\nInvalid `db.post.findMany()` invocation in\n/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18\n\n 1 import { db } from 'src/lib/db'\n 2 \n 3 export const posts = () => {\nβ 4 return db.post.findMany(\nDatabase `rw-auth` does not exist on the database server at `localhost:5432`."
api | }
api | 16:54:20 π² undefined undefined request completed 52ms
api | π Custom
api | {
api | "time": 1688331260993,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "reqId": "req-2",
api | "res": {
api | "statusCode": 200
api | },
api | "msg": "request completed"
api | }
api | 16:54:20 π¨ undefined graphql-server
api | Invalid `db.post.findMany()` invocation in
api | /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | β 4 return db.post.findMany(
api | Database `rw-auth` does not exist on the database server at `localhost:5432`.
api |
api | π¨ GraphQLError Info
api |
api | {
api | "path": [
api | "articles"
api | ],
api | "locations": [
api | {
api | "line": 2,
api | "column": 3
api | }
api | ],
api | "extensions": {}
api | }
api |
api | π₯ Error Stack
api |
api | Error:
api | Invalid `db.post.findMany()` invocation in
api | /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | β 4 return db.post.findMany(
api | Database `rw-auth` does not exist on the database server at `localhost:5432`.
api | at pn.handleRequestError (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:176:6750)
api | at pn.handleAndLogRequestError (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:176:5907)
api | at /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:3087
api | at async /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:3294
api | at async t._executeRequest (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:10755)
api | at async t._request (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:10484)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async Promise.all (index 0)
api |
api | π Custom
api | {
api | "time": 1688331260990,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "\nInvalid `db.post.findMany()` invocation in\n/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18\n\n 1 import { db } from 'src/lib/db'\n 2 \n 3 export const posts = () => {\nβ 4 return db.post.findMany(\nDatabase `rw-auth` does not exist on the database server at `localhost:5432`."
api | }
api | 16:54:20 π¨ undefined undefined
api | Invalid `db.post.findMany()` invocation in
api | /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | β 4 return db.post.findMany(
api | Database `rw-auth` does not exist on the database server at `localhost:5432`.
api |
api | π¨ GraphQLError Info
api |
api | {
api | "path": [
api | "articles"
api | ],
api | "locations": [
api | {
api | "line": 2,
api | "column": 3
api | }
api | ],
api | "extensions": {}
api | }
api |
api | π₯ Error Stack
api |
api | Error:
api | Invalid `db.post.findMany()` invocation in
api | /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18
api |
api | 1 import { db } from 'src/lib/db'
api | 2
api | 3 export const posts = () => {
api | β 4 return db.post.findMany(
api | Database `rw-auth` does not exist on the database server at `localhost:5432`.
api | at pn.handleRequestError (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:176:6750)
api | at pn.handleAndLogRequestError (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:176:5907)
api | at /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:3087
api | at async /Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:3294
api | at async t._executeRequest (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:10755)
api | at async t._request (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@prisma/client/runtime/library.js:179:10484)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async field.resolve (/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/node_modules/@envelop/on-resolve/cjs/index.js:33:42)
api | at async Promise.all (index 0)
api |
api | π Custom
api | {
api | "time": 1688331260991,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "\nInvalid `db.post.findMany()` invocation in\n/Users/nik/dev/learning/Redwoodjs/redwood-tutorial/api/src/services/posts/posts.js:4:18\n\n 1 import { db } from 'src/lib/db'\n 2 \n 3 export const posts = () => {\nβ 4 return db.post.findMany(\nDatabase `rw-auth` does not exist on the database server at `localhost:5432`."
api | }
api | 16:54:20 π undefined undefined Processing GraphQL Parameters done.
api | π Custom
api | {
api | "time": 1688331260991,
api | "pid": 32363,
api | "hostname": "Nikolajs-MacBook-Pro.local",
api | "msg": "Processing GraphQL Parameters done."
api | }
My suspicion that this problem is based on insufficient access right, however, I am confused by the error message
16:54:15 π undefined Fastify server configuration
Assuming that this discussion (including the solution) would be of interest, I will stuff it in the solutions category in https://community.redwoodjs.com/