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

Error creating NextJsSite - Conflicting Names due to AssetPolicy #13

Closed
cmanou opened this issue Feb 26, 2024 · 1 comment
Closed

Error creating NextJsSite - Conflicting Names due to AssetPolicy #13

cmanou opened this issue Feb 26, 2024 · 1 comment

Comments

@cmanou
Copy link
Contributor

cmanou commented Feb 26, 2024

In

function createS3Bucket() {
const bucket = new Bucket(
`${name}Assets`,

it creates the bucket ${name}Assets which then creates a policy internally
new aws.s3.BucketPolicy(
`${name}Policy`,

which appends Policy, but then in SsrSite we also create a bucket policy with the the same suffix AssetsPolicy
new aws.s3.BucketPolicy(
`${name}AssetsPolicy`,
which ends up conflicting.

VisibleError: Invalid component name "WebAssetsPolicy". Component names must be unique.
    at file:///.../.sst/platform/src/auto/run.ts:39:13
    at new Resource (/.../.sst/platform/node_modules/@pulumi/resource.ts:399:26)
    at new CustomResource (/.../.sst/platform/node_modules/@pulumi/resource.ts:897:9)
    at new BucketPolicy (/.../.sst/platform/node_modules/@pulumi/s3/bucketPolicy.ts:116:9)
    at file:///.../.sst/platform/src/components/aws/bucket.ts:237:11
    at /.../.sst/platform/node_modules/@pulumi/output.ts:398:31
    at Generator.next (<anonymous>)
    at /.../.sst/platform/node_modules/@pulumi/pulumi/output.js:21:71
    at new Promise (<anonymous>)
    at __awaiter (/.../.sst/platform/node_modules/@pulumi/pulumi/output.js:17:12)

Additionally you are only allowed one bucket policy and last write wins, so even if the names don't conflict there is an issue.

@cmanou
Copy link
Contributor Author

cmanou commented Feb 28, 2024

Fixed in 07bb377

@cmanou cmanou closed this as completed Feb 28, 2024
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

1 participant