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

When I try to publish I getInvalidClientTokenId #40

Open
shotap opened this issue Dec 26, 2022 · 1 comment
Open

When I try to publish I getInvalidClientTokenId #40

shotap opened this issue Dec 26, 2022 · 1 comment

Comments

@shotap
Copy link

shotap commented Dec 26, 2022

Hi, I'm running nestjs application inside of EKS pod, when I try to publish to a queue I get the error:

InvalidClientTokenId: The security token included in the request is invalid.

I publish using the SQS service:

import { SqsService } from '@ssut/nestjs-sqs';
import { Message } from '@ssut/nestjs-sqs/dist/sqs.types';

@Injectable()
export class TestService {
  constructor(readonly sqsService: SqsService) {}

  public publishToTestQueue(messages: Message<Test>) {
    return this.sqsService.send('test-q', messages);
  }
}

I initialise the service:

@Module({
  imports: [
    SqsModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        consumers: [],
        producers: [
          {
            name: 'test-q',
            queueUrl: configService.get('TEST_Q'),
            region: configService.get('AWS_REGION'),
          },
        ],
      }),
      inject: [ConfigService],
    }),
  ],
})

I initiate the AWS SDK without security keys, I have a role attached to the pod and I want the app to utilize the role:

AWS.config.update({ region: this.configService.get('AWS_REGION') });

What am I missing here?

@hammad-ulhassan
Copy link

@shotap were you able to resolve the issue? i am getting same error

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