Innablr / revolver

AWS Powercycle Facility
MIT License
2 stars 3 forks source link

SNS/SQS clients fail when running revolver outside of Lambda #346

Closed lyricnz closed 3 months ago

lyricnz commented 3 months ago

This appears to be because when running locally without $AWS_REGION defined, SNS/SQS clients do not use /default/settings/region. S3 does not fail like this because it has an explicit region setting.

lyricnz commented 3 months ago

Problem is that getAwsConfig() doesn't have the configuration file as context, so can't use it. Need to fix it further back.

lyricnz commented 3 months ago

I think the SQS/SNS clients should explicitly use the context-region, rather than relying on the behaviour of the SDK (and a variable that exists only in a Lambda context).

  protected async writeSQS() {
    const config = getAwsConfig(this.context?.region); // <====
    ... 
lyricnz commented 3 months ago

Added the explicit region to https://github.com/Innablr/revolver/pull/345

lyricnz commented 3 months ago

@alutman-innablr @abukharov does this seem safe/correct? When running in Lambda, $AWS_REGION is provided which matches the Lambda deployment, but this is not the case when running locally (and maybe should not be relied upon?).