nestjs-sqs
nestjs-sqs copied to clipboard
When I try to publish I getInvalidClientTokenId
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?
@shotap were you able to resolve the issue? i am getting same error