title: Deploy react app to S3Bucket from bitbucket pipeline
body: <p>I am trying to deploy React app to AWS S3 bucket from BitBucket. When i run the pipeline custom:staging, i got error. Here is my bitbucket-pipelines.yml file:</p>
  <pre><code>image: node:10.15.3
  
  pipelines:
    custom: # Pipelines that can only be triggered manually
      staging:
        - step:
            name: Installing &amp; Running Tests
            caches:
              - node
            script:
              - rm -rf package-lock.json
              - rm -rf node_modules
              - npm install
              - npm run test
        - step:
            name: Build
            script:
              - npm install --production
              - REACT_APP_ENVIRONMENT=staging npm run build
            artifacts:
              - build/**
        - step:
            name: Deploy to S3
            deployment: staging
            script:
              - pipe: atlassian/aws-s3-deploy:0.2.4
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  S3_BUCKET: $STAGING_BUCKET_NAME
                  ACL: &quot;public-read&quot;
                  LOCAL_PATH: &quot;build&quot;
        - step:
            name: Invalidate Cloudfront Cache
            script:
              - pipe: atlassian/aws-cloudfront-invalidate:0.1.1
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  DISTRIBUTION_ID: $STAGING_DISTRIBUTION_ID
      production:
        - step:
            name: Installing &amp; Running Tests
            caches:
              - node
            script:
              - rm -rf package-lock.json
              - rm -rf node_modules
              - npm install
              - npm run test
        - step:
            name: Build
            script:
              - npm install --production
              - REACT_APP_ENVIRONMENT=production npm run build
            artifacts:
              - build/**
        - step:
            name: Deploy to S3
            deployment: production
            script:
              - pipe: atlassian/aws-s3-deploy:0.2.4
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  S3_BUCKET: $PRODUCTION_BUCKET_NAME
                  ACL: &quot;public-read&quot;
                  LOCAL_PATH: &quot;build&quot;
        - step:
            name: Invalidate Cloudfront Cache
            script:
              - pipe: atlassian/aws-cloudfront-invalidate:0.1.1
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  DISTRIBUTION_ID: $PRODUCTION_DISTRIBUTION_ID
    branches:
      master:
        - step:
            name: Installing &amp; Running Tests
            caches:
              - node
            script:
              - rm -rf package-lock.json
              - rm -rf node_modules
              - npm install
              - npm run test
  
  </code></pre>
  <p>I am keep getting this error.</p>
  <p>The environment 'staging' in your bitbucket-pipelines.yml doesn’t match any environment defined in your settings. Either update your yml, or your settings, to use the same name.</p>
  <p>I checked the indentation. Indentation seems correct.</p>