Internal Server Error whilst testing HTTP requests
medic-code opened this issue · 2 comments
I'm getting a status 500 error despite running the docker container and the seed data is in the database. I've been using VS Code REST Client to send real HTTP requests within VS Code as a way to get a feel for the API endpoints.
Environment
OS: Windows 10 Pro Version 22H2 OS Build 19045.2251
IDE: VS Code Version 1.73.0
Docker: Docker Desktop 4.15.0 (93002)
Steps to reproduce
- Use VS Code
- Install REST Client https://marketplace.visualstudio.com/items?itemName=humao.rest-client
- Clone repo and follow readme instructions
- Run dev server
npm run dev
- Run docker container using
npm run start-docker-postgres
Seed data:
- Create signup.rest file with the below
POST http://localhost:3001/api/users
Content-Type: application/json
{
"username": "test user",
"password": "12345",
"email": "test@userRouter.com",
"knownLanguageId": "de",
"learnLanguageId": "fr",
}
- Press 'send request' on signup.rest file
Actual Result:
HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 106
ETag: W/"6a-gCklfnms/BiQVKxCNQatNMNsdUI"
Date: Sun, 04 Dec 2022 22:10:31 GMT
Connection: close
{
"error": {
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
}
}
Expected Result
Status code 201 with sanitised user object
Other steps taken
I've tried running the dev,staging, prod server and still getting a status 500, restarted the docker container. Just wondering if there's something else I'm missing here ?
I was doing this as I wasn't quite sure where the status code 406 comes from when looking at the tests when someone tries to signup with a email address already signed up. I couldn't find the 406 status within the services code logic.
I am running into this issue when trying to create a new user locally. There is a comment in the users
routes that says investigate issue with incorrect credentials for sendgrid causing a 500 error
, so it seems to be something to do with sendgrid. Maybe @mrchrmn knows something more about this issue?
Two comments, not sure if helpful.
- The email verification step only works with a valid API key for Sendgrid.
- The 406 errors come from throwing the NotAcceptable on various occasions.