Closed ztrange closed 1 year ago
I figured out the issue is caused by the sdk v2 and a workaround is using the node sdk v3:
const { SNSClient, PublishCommand } = require('@aws-sdk/client-sns');
const { SQSClient, ReceiveMessageCommand } = require('@aws-sdk/client-sqs');
async function publish(msg) {
const sns = new SNSClient({
region: 'us-east-1',
accessKeyId: 'x',
secretAccessKey: 'x',
endpoint: 'http://localhost:4200',
});
await sns.send(
new PublishCommand({
TopicArn: 'arn:aws:sns:us-east-1:100010001000:local-topic1',
Message: `Hello World, ${msg}}`,
}),
);
}
async function listen() {
const sqs = new SQSClient({
region: 'us-east-1',
accessKeyId: 'x',
secretAccessKey: 'x',
endpoint: 'http://localhost:4200',
});
const response = await sqs.send(
new ReceiveMessageCommand({
QueueUrl: 'http://localhost:4200/queue/local-queue3',
AttributeNames: ['All'],
MaxNumberOfMessages: 10,
MessageAttributeNames: ['All'],
WaitTimeSeconds: 5,
}),
);
return response;
}
async function run() {
await publish('test');
const result = await listen();
console.log(result);
}
run().then(() => console.log('done'));
I'm closing this, since it was only created FYI.
Using the default config. I only changed the
Host
value in line 3 tolocalhost
The error thrown by aws node sdk v2:
This is the code that I used to test: