Skip to content

StacBrowser construct doesn't prefix S3 keys when pathPrefix is set #313

Description

@botanical

When pathPrefix is set on the StacBrowser construct, the build correctly bakes the prefix into the app's publicPath but I think the files in BucketDeployment get uploaded to the root regardless of what pathPrefix is set to.

We have to rewrite the path downstream in order to properly serve anything in the bucket behind the prefix path.

so the proposed change would be something like:

        this.bucketDeployment = new s3_deployment.BucketDeployment(this, 'BucketDeployment', {
            destinationBucket: this.bucket,
            destinationKeyPrefix: props.pathPrefix?.replace(/^\/+|\/+$/g, ''),
            sources: [s3_deployment.Source.asset(buildPath)],
            memoryLimit: 1024,
            ephemeralStorageSize: Size.mebibytes(1024),
          });

Acceptance Criteria

  • destinationKeyPrefix is set to match pathPrefix when it's provided
  • The existing behavior is unchanged when pathPrefix isn't set
  • Testing done

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions