From b54c331bef0d4ad1ba1111700dc9f1bf64c1ea51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Mon, 30 Jan 2023 12:49:14 +0100 Subject: [PATCH] fix: sqs configuration for aws sdk v3 --- bundle.sh | 4 ++++ packages/analytics/src/Bootstrap/Container.ts | 4 +++- packages/auth/src/Bootstrap/Container.ts | 5 +++-- packages/event-store/src/Bootstrap/Container.ts | 4 +++- packages/files/src/Bootstrap/Container.ts | 4 +++- packages/revisions/src/Bootstrap/Container.ts | 4 +++- packages/scheduler/src/Bootstrap/Container.ts | 4 +++- packages/syncing-server/src/Bootstrap/Container.ts | 4 +++- packages/websockets/src/Bootstrap/Container.ts | 4 +++- packages/workspace/src/Bootstrap/Container.ts | 4 +++- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/bundle.sh b/bundle.sh index 8d2d06e24..3e20fe66d 100755 --- a/bundle.sh +++ b/bundle.sh @@ -13,6 +13,10 @@ echo "Bundling and building local docker image for service: $SERVICE" rm -rf $TMPDIR/bundle-$SERVICE/ mkdir -p $TMPDIR/bundle-$SERVICE +yearn clean + +yarn workspace @standardnotes/$SERVICE-server build + yarn workspace @standardnotes/$SERVICE-server bundle --no-compress --output-directory $TMPDIR/bundle-$SERVICE docker build $TMPDIR/bundle-$SERVICE -f $TMPDIR/bundle-$SERVICE/packages/$SERVICE/Dockerfile -t standardnotes/$SERVICE:local \ No newline at end of file diff --git a/packages/analytics/src/Bootstrap/Container.ts b/packages/analytics/src/Bootstrap/Container.ts index bb5cb7018..248dbf8ea 100644 --- a/packages/analytics/src/Bootstrap/Container.ts +++ b/packages/analytics/src/Bootstrap/Container.ts @@ -114,9 +114,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/auth/src/Bootstrap/Container.ts b/packages/auth/src/Bootstrap/Container.ts index c23fe4895..577a05723 100644 --- a/packages/auth/src/Bootstrap/Container.ts +++ b/packages/auth/src/Bootstrap/Container.ts @@ -260,7 +260,6 @@ export class ContainerConfigLoader { if (env.get('SNS_TOPIC_ARN', true)) { const snsConfig: SNSClientConfig = { - apiVersion: 'latest', region: env.get('SNS_AWS_REGION', true), } if (env.get('SNS_ENDPOINT', true)) { @@ -277,9 +276,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/event-store/src/Bootstrap/Container.ts b/packages/event-store/src/Bootstrap/Container.ts index a0cbf17b6..ed1a14681 100644 --- a/packages/event-store/src/Bootstrap/Container.ts +++ b/packages/event-store/src/Bootstrap/Container.ts @@ -30,9 +30,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/files/src/Bootstrap/Container.ts b/packages/files/src/Bootstrap/Container.ts index d83190a36..cf454ea6b 100644 --- a/packages/files/src/Bootstrap/Container.ts +++ b/packages/files/src/Bootstrap/Container.ts @@ -125,9 +125,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/revisions/src/Bootstrap/Container.ts b/packages/revisions/src/Bootstrap/Container.ts index 61cd7c7d2..0ef5df9be 100644 --- a/packages/revisions/src/Bootstrap/Container.ts +++ b/packages/revisions/src/Bootstrap/Container.ts @@ -86,9 +86,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/scheduler/src/Bootstrap/Container.ts b/packages/scheduler/src/Bootstrap/Container.ts index 40b8c95ee..d136e55e8 100644 --- a/packages/scheduler/src/Bootstrap/Container.ts +++ b/packages/scheduler/src/Bootstrap/Container.ts @@ -94,9 +94,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/syncing-server/src/Bootstrap/Container.ts b/packages/syncing-server/src/Bootstrap/Container.ts index b4b20fed5..4fe421524 100644 --- a/packages/syncing-server/src/Bootstrap/Container.ts +++ b/packages/syncing-server/src/Bootstrap/Container.ts @@ -146,9 +146,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/websockets/src/Bootstrap/Container.ts b/packages/websockets/src/Bootstrap/Container.ts index 2d8318fd7..e67be7522 100644 --- a/packages/websockets/src/Bootstrap/Container.ts +++ b/packages/websockets/src/Bootstrap/Container.ts @@ -76,9 +76,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true), diff --git a/packages/workspace/src/Bootstrap/Container.ts b/packages/workspace/src/Bootstrap/Container.ts index c535f462c..b476ef8fb 100644 --- a/packages/workspace/src/Bootstrap/Container.ts +++ b/packages/workspace/src/Bootstrap/Container.ts @@ -104,9 +104,11 @@ export class ContainerConfigLoader { if (env.get('SQS_QUEUE_URL', true)) { const sqsConfig: SQSClientConfig = { - apiVersion: 'latest', region: env.get('SQS_AWS_REGION', true), } + if (env.get('SQS_ENDPOINT', true)) { + sqsConfig.endpoint = env.get('SQS_ENDPOINT', true) + } if (env.get('SQS_ACCESS_KEY_ID', true) && env.get('SQS_SECRET_ACCESS_KEY', true)) { sqsConfig.credentials = { accessKeyId: env.get('SQS_ACCESS_KEY_ID', true),