Skip to content

Configuring API domains via output variables? #22

@gregsabo

Description

@gregsabo

The template currently sets the API domain manually in config.js. Can this be done automatically with output variables?

Here's what I've tried so far:

In API's serverlesss.yaml:

app: myapp
org: foobar
component: express
name: api

inputs:
  src: ./

In the site's serverless.yaml:

app: myapp
org: foobar
component: website
name: app

inputs:
  src:
    src: ./
    hook: npm run build
    dist: build
    env:
      REACT_APP_API_ROOT: ${output:api.apiGatewayUrl}

But running serverless deploy in the app folder gives this error:

Serverless › Failed running "src.hook": "npm run build" due to the following error: Command failed: npm run build
env: node: No such file or directory

I'm guessing this error is because it can't resolve the output:api.apiGatewayUrl variable. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions