Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQS receive message failed: Could not load credentials from any providers #3

Open
KozielGPC opened this issue Oct 13, 2023 · 1 comment

Comments

@KozielGPC
Copy link

I'm trying to setup a sqs consumer in nestjs using this package but I'm having some troubles. When I start my application I get the error below:

image

My setup:

"dependencies": {
    "@apollo/server": "^4.9.3",
    "@graphql-tools/utils": "^10.0.6",
    "@nestjs/apollo": "^12.0.9",
    "@nestjs/common": "^10.2.6",
    "@nestjs/config": "^3.1.1",
    "@nestjs/core": "^10.2.6",
    "@nestjs/graphql": "^12.0.9",
    "@nestjs/platform-express": "^8.0.0",
    "@prisma/client": "^5.3.1",
    "@ssut/nestjs-sqs": "^2.2.0",
    "aws-sdk": "^2.1473.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "graphql": "^16.8.1",
    "graphql-tools": "^9.0.0",
    "prisma": "^5.3.1",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
@juanibarral
Copy link

Hi @KozielGPC , if you are trying out with localstack I struggled with the same issue. This thread saved my life: ssut/nestjs-sqs#49

Basically you need to add an SQSClient to the SqsModule registration.

SqsModule.register({
            consumers: [
                {
                    name: config.SQS_QUEUE_NAME,
                    queueUrl: config.SQS_QUEUE_URL,
                    region: config.AWS_REGION,
                    sqs: new SQSClient({
                        endpoint: 'http://localhost:4566',
                        region: config.AWS_REGION,
                    })
                }
            ],
            producers: [],
        })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants