Worked then didn't work - create note

#1

I’d been using the create API w/o any problems. I headed off to another area, came back and found that any Lambda calls I was making to dynamoDB were timing out after trying to put an item. The code works fine when invoked locally. There are just no log entries in cloudwatch after a put.

The code is pretty much just like the demo app create except simplified:

import uuid from "uuid";
import * as dynamoDbLib from "../libs/dynamodb-lib";
import { success, failure } from "../libs/response-lib";



export async function main(event, context) {
    console.log(111)



  const data = JSON.parse(event.body);
  const params = {
    TableName: <MY TABLE NAME>",
    Item: {
      userId: uuid.v1(),
      noteId: uuid.v1(),
      content: "bla bla",
      attachment: "123",
      createdAt: Date.now()
    }
  };

  console.log("Before the put")
  try {
    await dynamoDbLib.call("put", params);
    console.log("After the put")
    return success(params.Item);
  } catch (e) {
      console.log(`Error of some type: ${e}`)
    return failure({ status: false });
  }

}

The cloudwatch log shows the following:

Any thoughts anyone?

0 Likes

#2

I took out the table name but it was there during my testing.

0 Likes

#3

Have you tested the API through this chapter?

0 Likes