Skip to content

"sst build" naively assumes it was invoked interactively with AWS credentials #1537

@octogonz

Description

@octogonz

We are trying to add SST-based projects to a large corporate monorepo, however the SST toolchain assumes it will always be invoked by a person with AWS credentials, and who can respond to STDIN prompts.

Repro steps

  1. npx create-serverless-stack@latest my-sst-app -- --language typescript
  2. cd my-sst-app
  3. npm run build

Actual behavior (problem)

  1. The CLI prompts to read interactive input from STDIN:
Look like you’re running sst for the first time in this directory. Please enter a stage 
name you’d like to use locally. Or hit enter to use the one based on your AWS 
credentials (Owner):
  1. Then the CLI refuses to proceed without AWS credentials:
EnvironmentCredentialsProviderFailure: Variable AMAZON_ACCESS_KEY_ID not set.

Expected behavior

It's fine to require AWS credentials for operations that do deployments or communicate with Amazon's cloud. However a developer should be able to compile source files and run Jest tests without AWS credentials.

Also the npm run build action must not prompt for STDIN input, because it is invoked by monorepo commands that build many projects in parallel.

Background

At our company, the SST projects exist in a monorepo that is used by many other developers, many of whom don't have AWS credentials at all, because they work on other project types such as client apps. Those developers need to compile SST projects and run unit tests for validation, but they do not need to run services or deploy service projects. (In fact, today I am able to build/test all the projects in our monorepo in "airplane mode" without any internet at all.)

If we add SST projects to this workspace, the SST toolchain needs to distinguish compiling/testing (sst build and sst test let's say) from running/deploying (sst start, sst deploy). The toolchain should assume that every user is a Serverless Stack developer with AWS credentials set up.

CC @frekje-wm @elliot-nelson @MickeyPhoenix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions