Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws lambda: access body payload from direct run #2416

Open
dimasxp opened this issue May 6, 2024 · 0 comments
Open

Aws lambda: access body payload from direct run #2416

dimasxp opened this issue May 6, 2024 · 0 comments

Comments

@dimasxp
Copy link

dimasxp commented May 6, 2024

Environment

node v18.18.2

Reproduction

Describe the bug

in case where s3 - event trigger -> runs lambda with nitro index.mjs

// router/index.ts
export default defineEventHandler(async (event) => {
	const body = await readBody(event);
        // body is empty here, 
});
//how to get original body payload from event trigger in event handler

Additional context

// payload from trigger:

{
  "Records": [
    {
      "eventVersion": "2.0",
      "eventSource": "aws:s3",
      "awsRegion": "us-east-1",
      "eventTime": "1970-01-01T00:00:00.000Z",
      "eventName": "ObjectCreated:Put",
      "userIdentity": {
        "principalId": "EXAMPLE"
      },
      "requestParameters": {
        "sourceIPAddress": "127.0.0.1"
      },
      "responseElements": {
        "x-amz-request-id": "EXAMPLE123456789",
        "x-amz-id-2": ""
      },
      "s3": {
        "s3SchemaVersion": "1.0",
        "configurationId": "testConfigRule",
        "bucket": {
          "name": "xxxxx",
          "ownerIdentity": {
            "principalId": "EXAMPLE"
          },
          "arn": "arn:aws:s3:::example-bucket"
        },
        "object": {
          "key": "xxxx.mp4",
          "size": 1024,
          "eTag": "xabcdef",
          "sequencer": "x4E5F678901"
        }
      }
    }
  ]
}

Logs

No response

@dimasxp dimasxp changed the title access body payload from direct run on aws lambda Access body payload from direct run on aws lambda May 6, 2024
@dimasxp dimasxp changed the title Access body payload from direct run on aws lambda Aws lambda: access body payload from direct run May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant