ips-coding-challenge / challenge_twitter

18 stars 7 forks source link

Registration error #58

Open mohamed-ali-amaira opened 3 years ago

mohamed-ali-amaira commented 3 years ago

Hi sir,

I really like your cool coding project, but when cloning it locally and trying to run it I am faced by this error everytime when I want to register :

error: password authentication failed for user "moham"
    at Parser.parseErrorMessage (C:\Users\moham\Documents\work\twirex\challenge_twitter\node_modules\pg-protocol\src\parser.ts:357:11)
    at Parser.handlePacket (C:\Users\moham\Documents\work\twirex\challenge_twitter\node_modules\pg-protocol\src\parser.ts:186:21)
    at Parser.parse (C:\Users\moham\Documents\work\twirex\challenge_twitter\node_modules\pg-protocol\src\parser.ts:101:30)
    at Socket.<anonymous> (C:\Users\moham\Documents\work\twirex\challenge_twitter\node_modules\pg-protocol\src\index.ts:7:48)
    at Socket.emit (events.js:375:28)
    at Socket.emit (domain.js:470:12)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at Socket.Readable.push (internal/streams/readable.js:204:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  length: 101,
  severity: 'FATAL',
  code: '28P01',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'auth.c',
  line: '334',
  routine: 'auth_failed'
}

the request I am sending is in the graphql playground and it is the following :

mutation {register(input : {
  username : "aziz"
  display_name : "aziz_1"
    email: "aziz@gmail.com"
  password: "A23@Gfgjj123"
}){
    token
    user {
      id
      email
    }

}
}

I would really appreciate it if you could help me

ips-coding-challenge commented 3 years ago

Hi ;). It doesn't seem related to the project but more with the credentials you use to connect to your database.

Look at this for example: https://stackoverflow.com/questions/55038942/fatal-password-authentication-failed-for-user-postgres-postgresql-11-with-pg/55039419

So be sure that the credentials you use to connect to the postgres database are correct ;).

mohamed-ali-amaira commented 3 years ago

It would be really nice to walk me through the process of cloning and setting the app from scratch on windows cuz I am frankly a beginner and I struggled for a day or so, thanks for your fast response you are a huge inspiration

mohamed-ali-amaira commented 3 years ago

I need especially a sql query to create the tables, if possible I want something compatible with postgresql, if there is another way to create the tables using typescript that would be really awesome

ips-coding-challenge commented 3 years ago

It's been a little while since I worked on this project but you have some migrations to run in order to create the tables in the database. You will have to change some configurations files first. I will try to update the README, to explain how to start with this repo ;).

Will try to work on it tomorrow if I can.

But notice that it's not finished yet ;).

ips-coding-challenge commented 3 years ago

Here are the steps to clone the repository and to get started

Get Started

Clone the repository

git clone https://github.com/ips-coding-challenge/challenge_twitter.git twitter_clone

Install the dependencies

npm install

It could take some time as the project needs puppeteer for scrapping ;)

Add the environment variables

create a .env.development file in the folder root

PORT=3000
JWT_SECRET=azeazeazezaezae
DB_HOST=YOUR_DB_HOST
DB_NAME=YOUR_DB_NAME
DB_USER=YOUR_POSTGRES_USER
DB_PASSWORD=YOUR_POSTGRES_PASSWORD

Run the migrations

You may need to install knex globally if you don't have it

npm install knex -g
knex migrate:latest --env development

Fill the database with some data

knex seed:run --env development

Run the app

npm run dev

Go to localhost:4000 ( Change the port accordingly to your configuration ) and you will have access to the GraphQL playground

If you have any questions, feel free to ask ;)