Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/api/integrations/event/sqs/sqs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class SqsController extends EventController implements EventControllerInt
accessKeyId: awsConfig.ACCESS_KEY_ID,
secretAccessKey: awsConfig.SECRET_ACCESS_KEY,
},

region: awsConfig.REGION,
endpoint: awsConfig.ENDPOINT || undefined,
});

this.logger.info('SQS initialized');
Expand Down Expand Up @@ -126,7 +126,9 @@ export class SqsController extends EventController implements EventControllerInt
? 'singlequeue'
: `${event.replace('.', '_').toLowerCase()}`;
const queueName = `${prefixName}_${eventFormatted}.fifo`;
const sqsUrl = `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;
const sqsUrl = sqsConfig.ENDPOINT
? `${sqsConfig.ENDPOINT.replace(/\/$/, '')}/${sqsConfig.ACCOUNT_ID}/${queueName}`
: `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;

const message = {
...(extra ?? {}),
Expand Down
2 changes: 2 additions & 0 deletions src/config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export type Sqs = {
SECRET_ACCESS_KEY: string;
ACCOUNT_ID: string;
REGION: string;
ENDPOINT: string;
MAX_PAYLOAD_SIZE: number;
EVENTS: {
APPLICATION_STARTUP: boolean;
Expand Down Expand Up @@ -585,6 +586,7 @@ export class ConfigService {
SECRET_ACCESS_KEY: process.env.SQS_SECRET_ACCESS_KEY || '',
ACCOUNT_ID: process.env.SQS_ACCOUNT_ID || '',
REGION: process.env.SQS_REGION || '',
ENDPOINT: process.env.SQS_ENDPOINT || '',
MAX_PAYLOAD_SIZE: Number.parseInt(process.env.SQS_MAX_PAYLOAD_SIZE ?? '1048576'),
EVENTS: {
APPLICATION_STARTUP: process.env?.SQS_GLOBAL_APPLICATION_STARTUP === 'true',
Expand Down