11import Dynamodb from 'aws-sdk/clients/dynamodb' ;
22import SNS from 'aws-sdk/clients/sns' ;
33import EventBridge from 'aws-sdk/clients/eventbridge' ;
4- import { wrap } from '@baselime/lambda-node-opentelemetry' ;
54
65const dynamo = new Dynamodb ( ) ;
76const sns = new SNS ( ) ;
87const eventbridge = new EventBridge ( ) ;
98
10- export const handler = wrap ( async ( event ) => {
9+ export const handler = async ( event , context ) => {
10+ context . callbackWaitForEmptyEventLoop = false ;
1111 await sns . publish ( { TopicArn : process . env . TOPIC_ARN , Message : 'wow much payload' } ) . promise ( )
1212 await eventbridge . putEvents ( {
1313 Entries : [ {
@@ -16,24 +16,24 @@ export const handler = wrap(async (event) => {
1616 } ]
1717 } ) . promise ( )
1818 const random = Math . random ( ) ;
19- if ( random < 0.3 ) {
20- const response = await dynamo . updateItem ( {
21- TableName : 'this-table-does-not-exist' ,
22- ReturnValues : 'ALL_NEW' ,
23- Key : {
24- id : {
25- S : 'test'
26- }
27- } ,
28- UpdateExpression : 'ADD #c :c' ,
29- ExpressionAttributeNames : {
30- '#c' : 'count'
31- } ,
32- ExpressionAttributeValues : {
33- ':c' : { N : '1' }
34- }
35- } ) . promise ( )
36- }
19+ // if(random < 0.3) {
20+ // const response = await dynamo.updateItem({
21+ // TableName: 'this-table-does-not-exist',
22+ // ReturnValues: 'ALL_NEW',
23+ // Key: {
24+ // id: {
25+ // S: 'test'
26+ // }
27+ // },
28+ // UpdateExpression: 'ADD #c :c',
29+ // ExpressionAttributeNames: {
30+ // '#c': 'count'
31+ // },
32+ // ExpressionAttributeValues: {
33+ // ':c': { N: '1' }
34+ // }
35+ // }).promise()
36+ // }
3737 const response = await dynamo . updateItem ( {
3838 TableName : process . env . DB_NAME ,
3939 ReturnValues : 'ALL_NEW' ,
@@ -56,4 +56,4 @@ export const handler = wrap(async (event) => {
5656 data : response
5757 } )
5858 }
59- } ) ;
59+ } ;
0 commit comments