Skip to content

Commit b17e658

Browse files
authored
Improving error subscription log (#427)
* Improving error subscription log * Test fix
1 parent e32e559 commit b17e658

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/sns/lib/utils/snsSubscriber.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ export async function subscribeToTopic(
9393
? topicConfiguration.Name
9494
: topicConfiguration.topicName
9595
}": ${err.message}`
96-
logger.error(errMessage)
9796

9897
if (
9998
subscriptionConfiguration.updateAttributesIfExists &&
10099
err.message.indexOf('Subscription already exists with different attributes') !== -1
101100
) {
101+
logger.warn(`${errMessage}. Trying to update subscription`)
102+
102103
const result = await tryToUpdateSubscription(
103104
snsClient,
104105
topicArn,
@@ -115,6 +116,8 @@ export async function subscribeToTopic(
115116
}
116117

117118
logger.error('Failed to update subscription')
119+
} else {
120+
logger.error(errMessage)
118121
}
119122

120123
throw new InternalError({

packages/sns/test/utils/testSnsConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { S3ClientConfig } from '@aws-sdk/client-s3'
22
import type { SNSClientConfig } from '@aws-sdk/client-sns'
33
import type { SQSClientConfig } from '@aws-sdk/client-sqs'
4+
import type { STSClientConfig } from '@aws-sdk/client-sts'
45
import { createLocalhostHandler } from 'fauxqs'
5-
66
import { getPort } from './fauxqsInstance.ts'
77

88
const isLocalstack = process.env.QUEUE_BACKEND === 'localstack'
99
const port = getPort()
1010

11-
export const TEST_AWS_CONFIG: SNSClientConfig & SQSClientConfig = {
11+
export const TEST_AWS_CONFIG: SNSClientConfig & SQSClientConfig & STSClientConfig = {
1212
endpoint: `http://localhost:${port}`,
1313
region: 'eu-west-1',
1414
credentials: {

0 commit comments

Comments
 (0)