multiplegeorges / vue-cli-plugin-s3-deploy

A vue-cli plugin that uploads your built Vue.js project to an S3 bucket
MIT License
331 stars 51 forks source link

Error: AWS Error: CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 #139

Open hungbang opened 3 years ago

hungbang commented 3 years ago

Error detail:

INFO  Connection to S3 created.
 ERROR  Bucket: frontend-stg could not be validated.
 ERROR  Bucket: frontend-stg could not be created.
 ERROR  {}
Error: AWS Error: CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
    at Bucket._callee2$ (/home/runner/work/akaka-ui/akaka-ui/node_modules/vue-cli-plugin-s3-deploy/bucket.js:145:23)
    at tryCatch (/home/runner/work/teemo-ui/akaka-ui/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/home/runner/work/akaka-ui/teemo-ui/node_modules/regenerator-runtime/runtime.js:293:22)
    at Generator.throw (/home/runner/work/teemo-ui/akaka-ui/node_modules/regenerator-runtime/runtime.js:118:21)
    at asyncGeneratorStep (/home/runner/work/teemo-ui/akaka-ui/node_modules/vue-cli-plugin-s3-deploy/bucket.js:14:103)
    at _throw (/home/runner/work/akaka-ui/akaka-ui/node_modules/vue-cli-plugin-s3-deploy/bucket.js:16:291)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Below are the git action deploy script:

name: CI

env:
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

on:
  push:
    branches: [ staging ]
  pull_request:
    branches: [ staging ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Configure AWS credentials from stg and prd account
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

      - name: Log information before deploying
        run: |
          echo "The Secret ID $AWS_ACCESS_KEY_ID"
          echo "The Secret Access Key $AWS_SECRET_ACCESS_KEY"
          echo "The AWS_ACCESS_KEY_ID ${{ secrets.AWS_ACCESS_KEY_ID }}"
          echo "The AWS_SECRET_ACCESS_KEY ${{ secrets.AWS_SECRET_ACCESS_KEY }}"

      - name: Run a multi-line script
        run: |
          printenv AWS_ACCESS_KEY_ID
          printenv AWS_SECRET_ACCESS_KEY

          yarn global add @vue/cli
          yarn add vue-cli-plugin-s3-deploy@next
          yarn install
          yarn build --mode staging
          yarn deploy --mode staging