Skip to content

Commit

Permalink
chore: add logs when publishing events to SNS
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega committed Jan 17, 2025
1 parent c9deda2 commit 21326c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion consumer-server/src/adapters/sns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { PublishCommand, SNSClient } from '@aws-sdk/client-sns'
import { AppComponents, PublisherComponent } from '../types'
import { AssetBundleConversionFinishedEvent, AssetBundleConversionManuallyQueuedEvent } from '@dcl/schemas'

export async function createSnsComponent({ config }: Pick<AppComponents, 'config'>): Promise<PublisherComponent> {
export async function createSnsComponent({ config, logs }: Pick<AppComponents, 'config' | 'logs'>): Promise<PublisherComponent> {

Check failure on line 5 in consumer-server/src/adapters/sns.ts

View workflow job for this annotation

GitHub Actions / install

Replace `·config,·logs·` with `⏎··config,⏎··logs⏎`
const logger = logs.getLogger('publisher')
const snsArn = await config.requireString('AWS_SNS_ARN')
const optionalEndpoint = await config.getString('AWS_SNS_ENDPOINT')

Expand All @@ -29,6 +30,9 @@ export async function createSnsComponent({ config }: Pick<AppComponents, 'config
})

await client.send(command)
logger.info('Published message to SNS', {
entityId: event.metadata.entityId,

Check failure on line 34 in consumer-server/src/adapters/sns.ts

View workflow job for this annotation

GitHub Actions / install

Delete `,`
})
}

return { publishMessage }
Expand Down
2 changes: 1 addition & 1 deletion consumer-server/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function initComponents(): Promise<AppComponents> {
const cdnS3 = s3Bucket ? new AWS.S3({}) : new MockAws.S3({})

const runner = createRunnerComponent()
const publisher = await createSnsComponent({ config })
const publisher = await createSnsComponent({ config, logs })

return {
config,
Expand Down

0 comments on commit 21326c7

Please sign in to comment.