ryanmurakami / pizza-luvrs

❤️🍕🍕❤️ Demo project for AWS Developer: Getting Started on Pluralsight
114 stars 255 forks source link

"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred" #20

Closed mojorisin closed 4 years ago

mojorisin commented 5 years ago

Thank you so much for the lesson Ryan! It's been very helpful. I am new to this and I was able to go through almost till the end without hiccups. Only at the end I am facing some issues, when it comes to reading objects back from DynamoDB. I can create an user and see the update in my database. But when I try to retrieve the user and the pizzas, there are failures and I get the following error. {"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}

You can find the logs attached below. node-error-log.txt

ryanmurakami commented 5 years ago

Hi @mojorisin,

Here's the key part of the error:

TypeError: Cannot read property 'username' of undefined
    at dynamoItemToUser (/var/app/current/data/users.js:50:23)
    at Response.DynamoStore.getItem (/var/app/current/data/users.js:21:20)
    at Request.<anonymous> (/var/app/current/node_modules/aws-sdk/lib/request.j

Looks like whatever object that username is a property is actually coming up undefined. Check if the object is getting passed correctly, or give it a default value.