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 Antwort
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
beantwortet vor 7 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen