deploying SAM template with GitHub Actions error: Cannot use both --resolve-s3 and --s3-bucket parameters in non-guided deployments

0

Hello-

I have an existing SAM template that has already been deployed. So, I have an active setup of Lambda, API Gateway, and DynamoDB. I am creating a GitHub Actions YAML to handle automatic SAM build/deploy steps when I push code to GitHub.

When I push to main, I get this error: "Error: Cannot use both --resolve-s3 and --s3-bucket parameters in non-guided deployments. Please use only one or use the --guided option for a guided deployment." However, I am NOT using both, see below for my full YAML file:

name: Run build, tests, and deployment on push 

on:
  push:
    branches:
    - main

jobs:
  build-deploy:
    runs-on: ubuntu-latest
    steps:
      # - uses: actions/checkout@v2
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v2
      - uses: aws-actions/setup-sam@v1
      - 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 }}
          aws-region: us-east-1
      # sam build 
      - run: sam build --use-container
      ## tests 
      # - uses: actions/checkout@v4
      - name: Configure AWS Credentials
        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 }}
          aws-region: us-east-1
      - name: Set up Python 3.11
        uses: actions/setup-python@v4
        with:
          python-version: 3.11
      # You can test your matrix by printing the current Python version
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.x'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
      - name: Test with pytest
        run: |
          pytest     
      - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --stack-name aws-resume-stack --s3-bucket ${{ secrets.S3_FOR_SAM }} --capabilities CAPABILITY_IAM --region us-east-1  

The configuration I used is similar to the YAML file in the article "Using GitHub Actions to deploy serverless applications" by Julian Wood. Thoughts on how to resolve this issue? Thanks!

1개 답변
0

Figured it out. The above command in the yaml works. What needs to change:

Delete line "resolve_s3=true" under [default.package.parameters] in the file samconfig.toml .

Of course, it seems like it would be best to do this AFTER your initial SAM setup / AFTER you have an active S3 bucket for your SAM.

Cheers.

Dlindqu
답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠