https://serverless-stack.com/ logo
#help
Title
# help
r

Ross Coundon

04/06/2022, 8:21 PM
I have a pretty straightforward stack definition to try out a WebSocket API but, when running
sst start
it deploys and starts up but then logs the message
Copy code
Missing region in config
and aborts with
Copy code
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
The deploy command I’m using is
Copy code
sst start --stage ross-dev --region eu-west-2
The stack itself looks like this:
Copy code
import * as sst from '@serverless-stack/resources';

export default class WebSocketStack extends sst.Stack {

  private api: sst.WebSocketApi;
  private connectionsTable: sst.Table;

  constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
    super(scope, id, props)

    this.connectionsTable = this.createConnectionsTable();
    this.api = this.createApi();
    this.api.attachPermissions([this.connectionsTable]);

    this.addOutputs({
      ApiEndpoint: this.api.url
    })
  }

  private createConnectionsTable(): sst.Table {
    return new sst.Table(this, 'connections-table', {
      fields: {
        PK: sst.TableFieldType.STRING,
        connectionId: sst.TableFieldType.STRING,
      },
      primaryIndex: {
        partitionKey: 'PK',
      }
    })
  }

  private createApi(): sst.WebSocketApi {
    return new sst.WebSocketApi(this, 'WebsocketApi', {
      accessLog: false,
      routes: {
        $connect: "src/main/handlers/wsHandlers.webSocketHandler",
        $disconnect: "src/main/handlers/wsHandlers.webSocketHandler",
        sendMessage: "src/main/handlers/wsHandlers.webSocketHandler",
      },
      defaultFunctionProps: {
        environment: {
          CONNECTIONS_TABLE: this.connectionsTable.tableName,
          REGION: this.region,
        },
      }
    })
  }
}
Any thoughts on what could be going on?
t

thdxr

04/06/2022, 8:32 PM
hm I think @Omi Chowdhury has this same issue, wasn't able to figure it out
cc @Frank could this be related to some of the config loading changes a while back?
lol we were on a screenshare and the other ross just showed us the same issue, think we know what's up - you can workaround by passing AWS_REGION into the sst start command
r

Ross Coundon

04/06/2022, 8:43 PM
😄 I’ll give that a go, cheers
That did the trick
f

Frank

04/06/2022, 9:00 PM
@thdxr yeah very likely.. taking a quick look..
j

Jared Utah

04/06/2022, 9:02 PM
This happened to me as well, I ran aws configure again, entered my IAM credentials and then noticed that the next prompt for default region was blank (the first time I had done this for the tutorial it had defaulted to the us-east-1), so I entered us-east-1 and then json for the next prompt that was also blank, and everything worked great.
f

Frank

04/07/2022, 3:15 AM
@Ross Coundon @Jared Utah just pushed out a fix in v0.69.5. You don’t need to set the
AWS_REGION
manually. Give it a try and let me know if it works for you.
r

Ross Coundon

04/07/2022, 6:35 AM
Yes, that worked, thanks for the super fast turnaround, Frank.
j

Jared Utah

04/07/2022, 2:19 PM
Thank you!