reactjs / server-components-demo

Demo app of React Server Components.
https://reactjs.org/server-components
MIT License
4.27k stars 640 forks source link

error: password authentication failed for user "notesadmin" #21

Closed dugiwarc closed 3 years ago

dugiwarc commented 3 years ago

I cloned the repo, and ran npm install When I access localhost:4000 I get the following error: error: password authentication failed for user "notesadmin"

poteto commented 3 years ago

Did you setup the database? Could you share the whole error?

tiberiu80 commented 3 years ago

I had the same error but then i setup db and worked. I had a problem setting up postgresql db but i fixed it and managed to start the app. My setup went like this: Step 1. Create the Database psql postgres

CREATE DATABASE notesapi; CREATE ROLE notesadmin WITH LOGIN PASSWORD 'password'; ALTER ROLE notesadmin WITH SUPERUSER; ALTER DATABASE notesapi OWNER TO notesadmin; \q All fine. Step 2 psql -d postgres -U notesadmin; <--- here i got ' psql: FATAL: Peer authentication failed for user "notesadmin" ' in terminal. After some quick research i found https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge which explains why you can't connect with 'notesadmin' user. I didn't want to change postgresconfig so i did some more research and found https://stackoverflow.com/questions/17443379/psql-fatal-peer-authentication-failed-for-user-dev/17443990 which led me to use psql -U notesadmin -h 127.0.0.1 -d notesapi which worked From here i did the following steps and app started \c notesapi

DROP TABLE IF EXISTS notes; CREATE TABLE notes ( id SERIAL PRIMARY KEY, created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL, title TEXT, body TEXT );

\q

Step 3. Run the seed script Finally, run npm run seed to populate some data. npm start Hope this save someone's time.