Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bucket Policy Already Exists #356

Open
nadar opened this issue Aug 23, 2023 · 0 comments
Open

Bucket Policy Already Exists #356

nadar opened this issue Aug 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@nadar
Copy link

nadar commented Aug 23, 2023

Description

I had an issue with existing Bucket Policy when creating a new deployment, i used bref.sh and @mnapoli mentioned i should probably create an issue directly here, so maybe there is something which could be improved in order to avoid that problem in future, or to get more insights why this happens to have a better understanding. Thanks anyhow for the great plugin!


Today we have tried to deploy a production application --stage prod from a site we deploy successful since weeks using serverless deploy --stage dev. So as mentioned we wanted to deploy the production env for the first time, and now the serverless commands ends up with: Resource handler returned message: "Bucket Policy Already Exists" (RequestToken: 1fea716b-3cf5-0165-7c69-aa25a60bfe5c, HandlerErrorCode: AlreadyExists)

serverless deploy

Deploying FOOBAR to stage dev (eu-central-1)

✖ Stack FOOBAR-dev failed to deploy (46s)
Environment: linux, node 20.5.1, framework 3.34.0, plugin 6.2.3, SDK 4.3.2
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
CREATE_FAILED: websiteAssetsPolicyFDAAA9C0 (AWS::S3::BucketPolicy)
Resource handler returned message: "Bucket Policy Already Exists" (RequestToken: 1fea716b-3cf5-0165-7c69-aa25a60bfe5c, HandlerErrorCode: AlreadyExists)

There must be something have changed with the lift plugin or s3 policy, because if a temporary remove the lift constructs annotation, it works. So it must be the lift part of the serverless.yml which makes the problem.

We also have then deleted the dev environment in order to test whether we can recreate this stage or not, but we were not able to setup the dev environment too.

How to Reproduce

service: foobar

params:
  prod:
    env: prod
    debug: 0
  dev:
    env: test
    debug: 1

provider:
  name: aws
  region: eu-central-1
  stage: dev
  environment:
    YII_ENV: ${param:env}
    YII_DEBUG: ${param:debug}

plugins:
  - ./vendor/bref/bref
  - serverless-lift

functions:
    website:
        handler: web/index.php
        description: 'FOOBAR Main Thread'
        runtime: php-82-fpm
        timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
        events:
            -   httpApi: '*'

constructs:
  website:
    type: server-side-website
    assets:
      '/resources/*': web/resources
      '/static/*': web/static

# Exclude files from deployment
package:
    patterns:
        - '!node_modules/**'
        - '!tests/**'
        - '!.tmp/**'

I saw there is an issue regarding this, but it seems to be old, and i tested with the proved option, but did not work as well => serverless/serverless#6923 (comment)

Additional Information

This is the original issue and reply from @mnapoli => brefphp/bref#1620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant