Can someone take a look at: <https://github.com/se...
# sst
o
Can someone take a look at: https://github.com/serverless-stack/serverless-stack/pull/1114 We’re having to have a floating change in our sst.jsons since our personal dev envs are in different regions than the upstream one
t
If you remove region from sst.json shouldn't it use the ambient region defined in your aws profile or AWS_REGON env var?
o
no its hardcoded to default to us-east-1
(didn’t know that GH pulled in the specific line, nice)
t
ah interesting, @Frank what do you think about this? In general I prefer to rely on aws cli standard behavior
o
To give you. more context we have a SLS and SST hybrid app. So we create a new stage in SEED for each dev, and set it to their closest region. SEED deploys all the services, then we need to run
sst start
from our laptops against that stage
f
@thdxr If used don’t the region to
us-east-1
and picked up the ambient region, should we also store the region in
.sst
as @Omi Chowdhury suggested? So in case ambient region changed, they don’t end up deploying to another region.
t
I feel the opposite way, I prefer our tool to work exactly how AWS cli works and have as little additional state as possible
f
Yeah that’s true… I think SST should do less “magic” here
@Omi Chowdhury does it work if we just removed defaulting the region to
us-east-1
for now, and each dev run
sst start
on the default stage configured in ur aws credentials?
o
yeah I think that should be fine, some people have a couple of different AWS profiles, so they can pass it as env var, and it’ll pick up the default region for that profile, right?
b
for what it’s worth - I’m +1 for @thdxr’s recommendation - I’ve always prefered mirroring of CLI behaviour
t
@Omi Chowdhury yeah exactly
o
I can open a PR for this - although is there a better way to read the region than suggested by this SO: https://stackoverflow.com/questions/57768714/get-region-from-aws-cli-using-node
f
Lemme share some code
So CDK should have already resolved the account and region inside the app, and exposes them as
CDK_DEFAULT_ACCOUNT
and
CDK_DEFAULT_REGION
. I think what we can do is: 1. not set the
DEFAULT_REGION
in `packages/cli/bin/scripts.js`; and 2. set region to something like
deployProps.region || process.env.CDK_DEFAULT_REGION || "us-east-1"
in
packages/resources/src/App.js
https://github.com/serverless-stack/serverless-stack/blob/master/packages/resources/src/App.ts#L183-L185
I think that should do it… on top of my head 😁
t
I thought if we do nothing it would just work haha
o
lol been investigating this - I made the changes the Frank suggested, the next roadblock is the DebugStack I modified
cli/assets/debug-stack/bin/index.js
to get its region from process.env but running into another issue. Everything deploys fine but now I’m getting this error on `sst start`:
Copy code
Failed to fetch resources. Error [ConfigError]: Missing region in config
    at Request.VALIDATE_REGION (/Users/omi/workspaces/node_modules/@serverless-stack/cli/node_modules/aws-sdk/lib/event_listeners.js:94:47)
I expect its because config.region is undefined during
cli/scripts/start.js
- but haven’t tracked down where config is getting passed down to AWS SDK
Any ideas?
f
Oh I see.. Lemme take a look in a bit.
Hey Omi, quick update. I’m working on a PR for this. Should have something by later today or tmr.
o
Sweet, thanks so much
f
Hey @Omi Chowdhury, the change is in v0.54.1
If region is not passed in through the cli arg and is not specified in
sst.json
, SST will respect the default region in the local aws config file
o
Yup, we’ve already upgraded 🙂