Giter Site home page Giter Site logo

Comments (2)

ztrange avatar ztrange commented on September 16, 2024

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'));

from goaws.

ztrange avatar ztrange commented on September 16, 2024

I'm closing this, since it was only created FYI.

from goaws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.