awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Creating a second environment does not update amplify files as expected #167

Open sak360 opened 3 years ago

sak360 commented 3 years ago

Describe the bug Some values (related to the video plugin) in amplify's config jsons do not get updated when creating a new environment.

To Reproduce Steps to reproduce the behavior:

  1. amplify init (let's call this prod). Setup with CMS and CloudFront distribution enabled (this will show us the full extent of the observed bug)
  2. amplify env add (let's call this dev)
  3. The following places will not be updated (hence leading to a few different errors) for the dev environment (and any other environment after that):
    • amplify/backend/auth/userPoolGroups/template.json
    • *admin-group-policy's resource name (input bucket name does not update as expected)
    • amplify/backend/auth/userPoolGroups/user-pool-group-precedence.json
    • Similar to above, (*admin-group-policy's resource name)
    • amplify/backend/api/vodaws/schema.graphql
    • videoObject's token field
    • amplify/backend/video/myvodstreams/props.json
    • contentDeliveryNetwork > functionName (same as the value in videoObject's token field above)

Expected behavior Expected the above values to update. Manually changing them fixed the issue, albeit just as a bandaid (since switching back and forth b/w environments causes the same issue)

Desktop (please complete the following information):

danielvouch commented 3 years ago

Hey @wizage is there any update on this?

kylekirkby commented 2 years ago

I'm trying to deploy a production environment and amplify-video is preventing us from going live with the production env. The Cloudfront distrubtion name is not changing based on the env set via the amplify cli..

@wizage - any idea how we can get unblocked regarding this?

kylekirkby commented 2 years ago

Following resources failed

Resource Name: rCloudFrontPublicKeydevelopxxxxxxxxx (AWS::CloudFront::PublicKey)
Event Type: create
Reason: Resource handler returned message: "Resource of type 'AWS::CloudFront::PublicKey' with identifier 'xxxxxx-develop-publickey-xxxx' already exists." (RequestToken: 5a5852ae-5f69-6202-d7e7-xxxxxxx, HandlerErrorCode: AlreadyExists)

Looking at my custom CF template, I have:

  rCloudFrontPublicKeydevelopvmhnul59:
    Type: AWS::CloudFront::PublicKey
    Properties:
      PublicKeyConfig:
        CallerReference: xxxxx-develop-publickey-xxxxxx
        Name: xxxxxxx-develop-publickey-xxxxxxx
        EncodedKey: "-----BEGIN PUBLIC KEY-----xxxxxxxxxxxxxxxxxx-----END PUBLIC KEY-----\n"
  rCloudFrontKeyGroup:
    Type: AWS::CloudFront::KeyGroup
    Properties:
      KeyGroupConfig:
        Name: !Sub "${pProjectName}-KeyGroup"
        Items:
            - !Ref rCloudFrontPublicKeydevelopvmhnul59

So the values are hard coded in. @wizage / @nathanagez - how can I update this to ensure multiple environments work?