fullstack-app icon indicating copy to clipboard operation
fullstack-app copied to clipboard

Configuring API domains via output variables?

Open gregsabo opened this issue 4 years ago • 0 comments

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?

gregsabo avatar Jan 27 '21 16:01 gregsabo