Hi, I’m receiving an error when I try to visit my ...
# help
m
Hi, I’m receiving an error when I try to visit my API endpoint. In the terminal, it says 'unhandled promise rejection …" and then in the browser it displays {“message”:“Internal Server Error”} Any help appreciated thanks From this page in the guide: https://serverless-stack.com/chapters/create-a-hello-world-api.html
f
Hey @Michael Bannon, can u shared ur Lambda function?
m
Copy code
export async function handler(event) {
  return {
    statusCode: 200,
    headers: { "Content-Type": "text/plain" },
    body: `Hello, World! Your request was received at ${event.requestContext.time}.`,
  };
}
I haven't changed any of the code just the same as was pulled down from following the guide
f
hmm.. can u share the full error message in the terminal?
m
Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Runtime.MalformedHandlerName: Bad handler","reason":"Runtime.MalformedHandlerName: Bad handler","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Runtime.MalformedHandlerName: Bad handler"," at process.<anonymous> (file:///C:/Users/peter/OneDrive/Documents/Michael%20Final%20Year/2021.2022/greenfinger/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)"," at process.emit (events.js:315:20)"," at processPromiseRejections (internal/process/promises.js:245:33)"," at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}
Ignore the part that says greenfinger, just renamed it because I'm trying to yes the notes application as the basis for my own project. Nothing else has been changed and I tried to complete it without changing the name and it threw the same error
Tried working through the guide further but the api endpoint seems to be causing all the issues for example
Making API request
{ status: 404, statusText: 'Not Found', data: { message: 'Not Found' } }
j
@Michael Bannon are you still having this issue?
f
Reporting back here, looking into this issue with @Michael Bannon. Likely caused by wrong partition and sort key names in the DynamoDB put item call.
m
Hi @Jaysorry I've been busy only getting back to you now. The error in this case seems resolved but still getting a network error when connecting to local host that appears when I opened the application or when I try to create a note