SmiffyKmc
SmiffyKmc

Reputation: 891

fatal error: An error occurred (SignatureDoesNotMatch)

I'm trying to use GitLabs DevOps feature to build, test and deploy a Vue.js application to S3. I can deploy the app fine on my local machine. But when setting up the .gitlab-ci.yml file to deploy to S3 I get this error.

fatal error: An error occurred (SignatureDoesNotMatch) when calling the ListObjects operation: The request signature we calculated does not match the signature you provided. Check your key and signing method. ERROR: Job failed: exit code 1

My .gitlab-ci.yml file is this...

variables:
    AWS_ACCESS_KEY_ID: "****"
    AWS_SECRET_ACCESS_KEY: “****”

build site:
    image: node:8.8.1
    stage: build
script:
    - npm install --progress=false
    - npm run build
artifacts:
    expire_in: 1 week
    paths:
        - dist

cache:
    paths:
        - node_modules/

all_tests:
    image: node:8.8.1
    stage: test
    script:
        - npm install
        - npm run test

deploy:
    environment: production
    image: python:latest
    script:
        - pip install awscli==1.11.89
        - aws s3 sync --acl public-read --delete dist/ s3://bucket

My bucket is public and also has this policy...

{
"Version": "2012-10-17",
"Id": "Policy1524147868577",
"Statement": [
    {
        "Sid": "****",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:*",
        "Resource": "arn:aws:s3:::bucket"
    }
]
}

I have no idea why it's working locally and not on GitLab. I am learning to do this and I want to do it right. If you have any information for me or anyone else who might read this please let me know.

Thanks in advance

Upvotes: 1

Views: 6876

Answers (1)

brhardwick
brhardwick

Reputation: 3085

Make sure you are pasting the secret correctly. I ran into this error because, when I copied the secret from an excel file, it stripped out certain special characters. This may be similar for you.

Likewise, as im sure you are aware, GitLab offers a great tutorial for doing this securely here: https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Upvotes: 3

Related Questions