Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage parameter not taken into consideration on hook and dist input parameters #828

Open
yannnis opened this issue Oct 23, 2020 · 1 comment

Comments

@yannnis
Copy link

yannnis commented Oct 23, 2020

Description

Hi folks . We are finding that the template below doesn't work. the stage parameter is just not taken into account on the hook (removed it on the example below) or the dist parameters.

Example error when trying the stage variable on dist

Error: ENOENT: no such file or directory, stat 'C:\dev\something\dist-${stage}'

Anything I m doing wrong?

Additional Data

name: something
component: website
stage: dev

provider:
  name: aws
  region: eu-central-1
  stage: ${stage}

inputs: # The configuration the Component accepts
  src:
    src: ./src
    hook: yarn run build:staging
    dist: ./dist-${stage}
    #domain: serverless.com
    bucketName: ${stage}-${name}-code-bucket
    indexDocument: index.html
    errorDocument: error.html  
@nasainsbury
Copy link

nasainsbury commented Oct 26, 2020

I can also not get this working:

app: online-surveys-ui
name: online-surveys-ui
org: nathansainsburyjisc
component: website
stage: dev

provider:
  name: aws
  runtime: nodejs12.x
  profile: online-surveys

inputs:
  src:
    src: ./src
    hook: npm run build:${stage}
    dist: ./build

When running:

sls deploy --stage dev

or

sls deploy --stage prod

I get the following error:

Serverless › Failed running "src.hook": "npm run build:${stage}" due to the following error: "undefined"

My packagage.json has these scripts:

  "scripts": {
    "start": "react-scripts start",
    "start:local": "REACT_APP_ENV=local HOST=0.0.0.0 react-scripts start",
    "build:local": "REACT_APP_ENV=local react-scripts build",
    "build:dev": "REACT_APP_ENV=dev react-scripts build",
    "build:prod": "REACT_APP_ENV=prod react-scripts build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

Also, I'm using:

components version: 3.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants