We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi I've noticed that an event in EventBridge is passed in this format (as seen from cloudwatch logs):
{ source: "some source", "detail-type": "some detail-type", detail: { someCustomDetail : "detail"} }
whereas the plugin passes data in this format
{ Source: "some source", DetailType: "some detail-type", Detail: { someCustomDetail : "detail"} }
Is there a way to ensure these are consistent?
The text was updated successfully, but these errors were encountered:
Hi, can you show me your code. The consuming functions do receive the correct format:
{ version: '0', id: 'xxxxxxxx-xxxx-xxxx-xxxx-1605085184180', source: 'acme.newsletter.campaign', account: '', time: '2020-11-11T08:59:44.180Z', region: 'eu-west-1', resources: [], detail: { 'E-Mail': 'some@someemail.some' }, 'detail-type': 'UserSignUp' }
Using the following example code:
serverless.yml:
plugins: - serverless-webpack - serverless-offline - serverless-offline-aws-eventbridge custom: webpack: webpackConfig: ./webpack.config.js includeModules: true serverless-offline: host: 0.0.0.0 serverless-offline-aws-eventbridge: port: 4010 debug: true provider: name: aws runtime: nodejs12.x stage: dev region: eu-west-1 functions: publishEvent: handler: events.publish events: - http: path: publish method: get consumeEvent: handler: events.consume events: - eventBridge: eventBus: marketing pattern: source: - acme.newsletter.campaign
events.js
import AWS from 'aws-sdk'; AWS.config.update({ apiVersion: '2015-10-07', accessKeyId: "YOURKEY", secretAccessKey: "YOURSECRET", region: "eu-west-1" }); export const publish = async () => { try { const eventBridge = new AWS.EventBridge({ endpoint: 'http://127.0.0.1:4010', region: 'eu-west-1' }); const test = await eventBridge.putEvents({ Entries: [ { EventBusName: 'marketing', Source: 'acme.newsletter.campaign', DetailType: 'UserSignUp', Detail: `{ "E-Mail": "some@someemail.some" }`, }, ] }).promise(); } catch (e) { console.error(e); return { statusCode: 400, body: 'could not publish' }; } return { statusCode: 200, body: 'published' }; } export const consume = async (event, context) => { console.log(event); return { statusCode: 200, body: 'consume' }; }
Using babel and webpack to transpile everything..
Sorry, something went wrong.
No branches or pull requests
Hi I've noticed that an event in EventBridge is passed in this format (as seen from cloudwatch logs):
whereas the plugin passes data in this format
Is there a way to ensure these are consistent?
The text was updated successfully, but these errors were encountered: