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

Invalid principal in policy #14

Open
anuj9196 opened this issue Sep 13, 2019 · 2 comments
Open

Invalid principal in policy #14

anuj9196 opened this issue Sep 13, 2019 · 2 comments

Comments

@anuj9196
Copy link

My serverless.yml configuration:

plugins:
  - fullstack-serverless
  - serverless-offline

custom:
  namePrefix: ${self:provider.stage}-${self:provider.region}
  fullstack:
    bucketName: serverless-${self:custom.namePrefix}-frontend
    distributionFolder: webapp/dist/webapp
    singlePageApp: true
    clientCommand: npm install && ng build --aot --prod
    clientSrcPath: webapp

But on deploying, it gives error

Serverless Error ---------------------------------------
 
  An error occurred: WebAppS3BucketPolicy - Invalid principal in policy (Service: Amazon S3; Status Code: 400; Error Code: MalformedPolicy; Request ID: EE986697DF548390; S3 Extended Request ID: 0c648uKWw85q+U9bTsGXoCUzUFT21wpDPFYjkwYw2RPEh1nfq83xXmjtVAuHmoTeGo8uPQOhhzM=).

The errors generating are random.

When there was no bucketName in the config, it was giving an error as

Bucket name should not contain uppercase characters

Sometimes, it gives

client generation failed
@hakimio
Copy link

hakimio commented Sep 14, 2019

Try to run sls package and inspect the generated cloudformation template.
Maybe, you misspelled some of the parameters or they don't exist ${self:provider.stage}, ${self:provider.region}, ${self:custom.namePrefix}.
Also, you can load the cloudformation template into cloudformation visual editor and run the automatic inspection there.

@andrewphahn
Copy link

Were you able to resolve the first issue? If not can you share the generated cloudformation template (in the .serverless folder).

The second issue

When there was no bucketName in the config, it was giving an error as

It should actually fail with 'Please specify a bucket name for the client in serverless.yml', but maybe providing a default that works would be a better solution. It will just be a change to lib/resources/resources.yml to change that and remove the validation (that is apparently broken) in lib/validate.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants