sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.12k stars 136 forks source link

Starting project with Invalid AWS Region throws a opaque error #295

Open ecarrizo2 opened 2 months ago

ecarrizo2 commented 2 months ago

Context:

Discord Thread The first time setup with SST/Ion was trying to follow up the examples on https://ion.sst.dev/docs/start/aws/api/ and the sst dev command was throwing an error:

Screenshot 2024-04-23 at 00 08 02

as Text

Error initializing aws:
   operation error SSM: GetParameter, failed to resolve service endpoint, Failed to parse uri: https://ssm.amazonaws.com

Log:

time=2024-04-23T00:04:53.309+01:00 level=INFO msg="checking for pulumi" path="x/Application Support/sst/bin/pulumi"
time=2024-04-23T00:04:53.417+01:00 level=INFO msg="checking for bun" path="x/Library/Application Support/sst/bin/bun"
time=2024-04-23T00:04:53.420+01:00 level=INFO msg="initializing project" version=0.0.292
time=2024-04-23T00:04:53.421+01:00 level=INFO msg="esbuild building"
time=2024-04-23T00:04:53.422+01:00 level=INFO msg="esbuild built" outfile=x/x/sst-text-to-speech/.sst/eval/eval-1713827093421.mjs
time=2024-04-23T00:04:53.422+01:00 level=INFO msg="evaluating config"
time=2024-04-23T00:04:53.456+01:00 level=INFO msg="config evaluated"
time=2024-04-23T00:04:53.456+01:00 level=INFO msg="checking platform"
time=2024-04-23T00:04:53.456+01:00 level=INFO msg="credentials found"
time=2024-04-23T00:04:53.457+01:00 level=INFO msg="fetching bootstrap"
time=2024-04-23T00:04:53.457+01:00 level=ERROR msg="exited with error" err="Error initializing aws:\n   operation error SSM: GetParameter, failed to resolve service endpoint, Failed to parse uri: https://ssm.amazonaws.com"

SST Version

Software Version (does not seem relevant for the issue)

Steps to reproduce:

OP: Now that I understand the root cause of what was causing my issue was an invalid AWS Configuration because of a typo, alternatives, and similar errors are produced when using valid string values but that are still invalid aws Zones e.g

Following steps to reproduce but using test as a AWS region You might get this output:

Error initializing aws:
   operation error SSM: GetParameter, https response error StatusCode: 0, RequestID: , request send failed, Post "https://ssm.test.amazonaws.com/": dial tcp: lookup ssm.test.amazonaws.com: no such host

// LOG:
ERROR msg="exited with error" err="Error initializing aws:\n   operation error SSM: GetParameter, https response error StatusCode: 0, RequestID: , request send failed, Post \"https://ssm.test.amazonaws.com/\": dial tcp: lookup ssm.test.amazonaws.com: no such host"

What solved the issue for me

In case it was not clear, this was solved by setting the AWS Region to a valid value such as us-east-1 in case it helps you out to quickly get you out of this problem.

Actions Required (?)

I'm unsure if this issue deserves any action but @jayair mentioned that probably we could handle this better as the error is pretty opaque, from my perspective, I was entirely sure that my aws config was good as I was looking at the wrong .aws/credentials file and at the end a very basic error put me off track.

thdxr commented 2 months ago

not entirely sure how best to handle this because there isn't a good way for us to catch this. we could have a list of regions we know aws supports but wondering if that will be brittle