aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 820 forks source link

Incorrect variables #3767

Closed waltermvp closed 4 years ago

waltermvp commented 4 years ago

Describe the bug

Anyone else experiencing this?, I get it for other vars as well. have no clue when/how it actually happens

Screen Shot 2020-03-25 at 3 11 45 PM
waltermvp commented 4 years ago

it also pollutes the IAM resources, both were added using the cli

Screen Shot 2020-03-25 at 3 16 15 PM
kaustavghosh06 commented 4 years ago

@waltermvp I have a few questions which would help us reproduce this issue: 1) Which analytics resource did you add via the CLI? Pinpoint or kinesis? 2) What was your amplify add/update function flow and did you give access to the above mentioned analytics resource added in step 1)?

waltermvp commented 4 years ago

@kaustavghosh06 thanks for the quick reply

  1. pinpoint
  2. yes the permissions were generated by the cli
kaustavghosh06 commented 4 years ago

Did you add pinpoint as a trigger data source or give permissions to the function category to access the pinpoint resource in amplify add/update function flow?

waltermvp commented 4 years ago

I gave permission to the function @kaustavghosh06

kaustavghosh06 commented 4 years ago

@waltermvp I followed these steps with v 4.17.1 of the CLI.

  1. amplify add analytics -> added pinpoint
  2. amplify add function -> gave access for pinpoint
  3. amplify push

This worked correctly with the following results:

Screen Shot 2020-03-25 at 3 16 21 PM Screen Shot 2020-03-25 at 3 17 14 PM

Few more questions: 1) Did you run amplify push or amplify function push? 2) Which version of the CLI are you on? 3) Can you share your amplify/backend/amplify-meta.json with us? Looks like the analytics dependsOn block is missing for the function resource - hence not populating the correct values.

waltermvp commented 4 years ago

@kaustavghosh06 Looking at your response makes me think that since the issue is caused because i added pinpoint with an earlier version. Is that a possibility? if so I can try removing and adding analytics with the latest cli version

  1. amplify push
  2. lastest 4.71.1
  3. see below the function in question is named createQR
{
    "providers": {
        "awscloudformation": {
            "AuthRoleName": "amplify-shoefix-dev-210801-authRole",
            "UnauthRoleArn": "arn:aws:iam::902034749111:role/amplify-shoefix-dev-210801-unauthRole",
            "AuthRoleArn": "arn:aws:iam::902034749111:role/amplify-shoefix-dev-210801-authRole",
            "Region": "us-east-1",
            "DeploymentBucketName": "amplify-shoefix-dev-210801-deployment",
            "UnauthRoleName": "amplify-shoefix-dev-210801-unauthRole",
            "StackName": "amplify-shoefix-dev-210801",
            "StackId": "arn:aws:cloudformation:us-east-1:902034749111:stack/amplify-shoefix-dev-210801/bb6b2bc0-13b6-11ea-a8a7-0ef7f3f34731",
            "AmplifyAppId": "d291sdqqo8zp78"
        },
        "categories": {
            "auth": {
                "shoefix7c8f1689": {}
            },
            "function": {
                "shoefix7c8f1689PostConfirmation": {
                    "GROUP": "customers"
                },
                "purchaseOrder": {},
                "shoefixStripe": {},
                "shoefixQuoteRequest": {},
                "shoefixSendEmailsOrder": {},
                "checkoutCartItems": {},
                "easyPostFunction": {},
                "shoefix": {},
                "shoefix7c8f1689": {},
                "QRImages": {},
                "shoefixFollowUpEmail": {},
                "shoefixMergeCartItem": {},
                "createQR": {}
            }
        }
    },
    "hosting": {
        "S3AndCloudFront": {
            "service": "S3AndCloudFront",
            "providerPlugin": "awscloudformation",
            "output": {
                "S3BucketSecureURL": "https://shoefix-20191130141332-hostingbucket-dev.s3.amazonaws.com",
                "WebsiteURL": "http://shoefix-20191130141332-hostingbucket-dev.s3-website-us-east-1.amazonaws.com",
                "Region": "us-east-1",
                "HostingBucketName": "shoefix-20191130141332-hostingbucket-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.302Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/hosting/template.json",
                "logicalId": "hostingS3AndCloudFront"
            }
        }
    },
    "auth": {
        "shoefix7c8f1689": {
            "service": "Cognito",
            "providerPlugin": "awscloudformation",
            "dependsOn": [
                {
                    "category": "function",
                    "resourceName": "shoefix7c8f1689PostConfirmation",
                    "triggerProvider": "Cognito",
                    "attributes": [
                        "Arn",
                        "Name"
                    ]
                }
            ],
            "output": {
                "AppClientSecret": "1qk6ccq7asu8lipa1bigu8d0vlrprsf3tf07b5p9p581l25nst1j",
                "UserPoolId": "us-east-1_X9sFG2XO1",
                "AppClientIDWeb": "3uh7t6duqfua2m0q7s4377ni0d",
                "AppClientID": "7p8udupuquq7gb5qpcfatbuvs9",
                "IdentityPoolId": "us-east-1:b6f58f5a-e646-45ba-b322-359236ac032a",
                "IdentityPoolName": "shoefix7c8f1689_identitypool_7c8f1689__dev",
                "UserPoolName": "shoefix7c8f1689_userpool_7c8f1689"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.303Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/auth/shoefix7c8f1689-cloudformation-template.yml",
                "logicalId": "authshoefix7c8f1689"
            }
        }
    },
    "api": {
        "shoefix": {
            "service": "AppSync",
            "providerPlugin": "awscloudformation",
            "output": {
                "authConfig": {
                    "additionalAuthenticationProviders": [
                        {
                            "authenticationType": "AMAZON_COGNITO_USER_POOLS",
                            "userPoolConfig": {
                                "userPoolId": "authshoefix7c8f1689"
                            }
                        }
                    ],
                    "defaultAuthentication": {
                        "authenticationType": "AWS_IAM"
                    }
                },
                "GraphQLAPIIdOutput": "5broslmjsjeupnbx3gf3jbw55e",
                "GraphQLAPIEndpointOutput": "https://6gzbbms33feyfnuaqaiqzq3nd4.appsync-api.us-east-1.amazonaws.com/graphql"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.304Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/api/cloudformation-template.json",
                "logicalId": "apishoefix"
            },
            "lastPushDirHash": "UV26F+7kZVLIaZpLA5Ek/V3uSSA="
        }
    },
    "function": {
        "shoefix7c8f1689PostConfirmation": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "analytics",
                    "resourceName": "shoefix",
                    "attributes": [
                        "Id",
                        "Region"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefix7c8f1689PostConfirmation-dev",
                "Name": "shoefix7c8f1689PostConfirmation-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.305Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefix7c8f1689PostConfirmation-cloudformation-template.json",
                "logicalId": "functionshoefix7c8f1689PostConfirmation"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.769Z",
            "lastPackageTimeStamp": "2020-03-25T16:22:02.793Z",
            "distZipFilename": "shoefix7c8f1689PostConfirmation-2f517838643643504242-build.zip",
            "lastPushDirHash": "XbDxXxRTL6MAED9DLpNVvKaBkKc="
        },
        "purchaseOrder": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "analytics",
                    "resourceName": "shoefix",
                    "attributes": [
                        "Id",
                        "Region"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:purchaseOrder-dev",
                "Name": "purchaseOrder-dev",
                "LambdaExecutionRole": "shoefixLambdaRole2a8db47d-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.305Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/purchaseOrder-cloudformation-template.json",
                "logicalId": "functionpurchaseOrder"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.776Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:47.081Z",
            "distZipFilename": "purchaseOrder-674559626770654b4b39-build.zip",
            "lastPushDirHash": "I+ktXocCuVCxBDm2tdaSkPOM1Gk="
        },
        "shoefixStripe": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefixStripe-dev",
                "Name": "shoefixStripe-dev",
                "LambdaExecutionRole": "shoefixLambdaRole71ef02ec-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.306Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefixStripe-cloudformation-template.json",
                "logicalId": "functionshoefixStripe"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.793Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:47.196Z",
            "distZipFilename": "shoefixStripe-6d553241375275457a45-build.zip",
            "lastPushDirHash": "X7FHhHm+0n5mJMU0samT24UgnaM="
        },
        "shoefixQuoteRequest": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "auth",
                    "resourceName": "shoefix7c8f1689",
                    "attributes": [
                        "UserPoolId"
                    ]
                },
                {
                    "category": "analytics",
                    "resourceName": "shoefix",
                    "attributes": [
                        "Id",
                        "Region"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefixQuoteRequest-dev",
                "Name": "shoefixQuoteRequest-dev",
                "LambdaExecutionRole": "shoefixLambdaRolea28f4762-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.307Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefixQuoteRequest-cloudformation-template.json",
                "logicalId": "functionshoefixQuoteRequest"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.795Z",
            "lastPackageTimeStamp": "2020-03-25T16:22:02.241Z",
            "distZipFilename": "shoefixQuoteRequest-3058597a437464663748-build.zip",
            "lastPushDirHash": "zcKamueTWWqaA6hljvSdN/aS7SI="
        },
        "shoefixSendEmailsOrder": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "auth",
                    "resourceName": "shoefix7c8f1689",
                    "attributes": [
                        "UserPoolId"
                    ]
                },
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefixSendEmailsOrder-dev",
                "Name": "shoefixSendEmailsOrder-dev",
                "LambdaExecutionRole": "shoefixLambdaRole9a9448f7-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.308Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefixSendEmailsOrder-cloudformation-template.json",
                "logicalId": "functionshoefixSendEmailsOrder"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.797Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:52.832Z",
            "distZipFilename": "shoefixSendEmailsOrder-756a4272757430674f59-build.zip",
            "lastPushDirHash": "vIgT8oJkJ9lEKkTAHvVxSDvJvVY="
        },
        "checkoutCartItems": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                },
                {
                    "category": "auth",
                    "resourceName": "shoefix7c8f1689",
                    "attributes": [
                        "UserPoolId"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:checkoutCartItems-dev",
                "Name": "checkoutCartItems-dev",
                "LambdaExecutionRole": "shoefixLambdaRoleef531593-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.309Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/checkoutCartItems-cloudformation-template.json",
                "logicalId": "functioncheckoutCartItems"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.800Z",
            "lastPackageTimeStamp": "2020-03-25T16:22:05.335Z",
            "distZipFilename": "checkoutCartItems-6445596264665132316a-build.zip",
            "lastPushDirHash": "fYXktPNBMHDoxqJbeAF7kpLJWgc="
        },
        "easyPostFunction": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:easyPostFunction-dev",
                "Name": "easyPostFunction-dev",
                "LambdaExecutionRole": "shoefixLambdaRoledec07700-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.309Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/easyPostFunction-cloudformation-template.json",
                "logicalId": "functioneasyPostFunction"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.802Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:49.251Z",
            "distZipFilename": "easyPostFunction-476b453437427035465a-build.zip",
            "lastPushDirHash": "C5Y/74ltgP7W2dTNaE8kCqTJrn4="
        },
        "shoefixFollowUpEmail": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefixFollowUpEmail-dev",
                "Name": "shoefixFollowUpEmail-dev",
                "LambdaExecutionRole": "shoefixLambdaRole9a112649-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.310Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefixFollowUpEmail-cloudformation-template.json",
                "logicalId": "functionshoefixFollowUpEmail"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.805Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:55.556Z",
            "distZipFilename": "shoefixFollowUpEmail-7156667568516a6d5043-build.zip",
            "lastPushDirHash": "aUMJkE7XgrUUVyoZACRQ+5i13mw="
        },
        "shoefixMergeCartItem": {
            "service": "Lambda",
            "providerPlugin": "awscloudformation",
            "build": true,
            "dependsOn": [
                {
                    "category": "auth",
                    "resourceName": "shoefix7c8f1689",
                    "attributes": [
                        "UserPoolId"
                    ]
                },
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:shoefixMergeCartItem-dev",
                "Name": "shoefixMergeCartItem-dev",
                "LambdaExecutionRole": "shoefixLambdaRole5ee186a4-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.311Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/shoefixMergeCartItem-cloudformation-template.json",
                "logicalId": "functionshoefixMergeCartItem"
            },
            "lastBuildTimeStamp": "2020-03-25T16:21:30.808Z",
            "lastPackageTimeStamp": "2020-03-25T16:21:34.205Z",
            "distZipFilename": "shoefixMergeCartItem-395a745641325265387a-build.zip",
            "lastPushDirHash": "escXlyk1A5KaTV1UetGfvY1zi94="
        },
        "createQR": {
            "build": true,
            "providerPlugin": "awscloudformation",
            "service": "Lambda",
            "dependsOn": [
                {
                    "category": "api",
                    "resourceName": "shoefix",
                    "attributes": [
                        "GraphQLAPIIdOutput",
                        "GraphQLAPIEndpointOutput"
                    ]
                },
                {
                    "category": "storage",
                    "resourceName": "QRImages",
                    "attributes": [
                        "BucketName"
                    ]
                },
                {
                    "category": "auth",
                    "resourceName": "shoefix7c8f1689",
                    "attributes": [
                        "UserPoolId"
                    ]
                }
            ],
            "output": {
                "Region": "us-east-1",
                "Arn": "arn:aws:lambda:us-east-1:902034749111:function:createQR-dev",
                "Name": "createQR-dev",
                "LambdaExecutionRole": "shoefixLambdaRole71698d9c-dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.316Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/function/createQR-cloudformation-template.json",
                "logicalId": "functioncreateQR"
            },
            "lastBuildTimeStamp": "2020-03-25T19:03:57.538Z",
            "lastPackageTimeStamp": "2020-03-25T19:04:00.748Z",
            "distZipFilename": "createQR-666f4154524c2f43304e-build.zip",
            "lastPushDirHash": "Mr8xhKrTv8TZLu1PXxuBm5MCrg0="
        }
    },
    "analytics": {
        "shoefix": {
            "service": "Pinpoint",
            "providerPlugin": "awscloudformation",
            "output": {
                "appName": "shoefix-dev",
                "Region": "us-east-1",
                "Id": "d1f3df206cbf4277aceb23677ff3f3cb"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.312Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/analytics/pinpoint-cloudformation-template.json",
                "logicalId": "analyticsshoefix"
            }
        }
    },
    "storage": {
        "QRImages": {
            "service": "S3",
            "providerPlugin": "awscloudformation",
            "output": {
                "BucketName": "qrimages-dev",
                "Region": "us-east-1"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.313Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/storage/s3-cloudformation-template.json",
                "logicalId": "storageQRImages"
            }
        }
    },
    "interactions": {
        "shoefixlex": {
            "service": "Lex",
            "providerPlugin": "awscloudformation",
            "build": true,
            "output": {
                "FunctionArn": "arn:aws:lambda:us-east-1:902034749111:function:shoefix_cfnlambda_5cd2a919-dev",
                "Region": "us-east-1",
                "BotName": "OrderFlowers_dev"
            },
            "lastPushTimeStamp": "2020-03-25T19:06:37.314Z",
            "providerMetadata": {
                "s3TemplateURL": "https://s3.amazonaws.com/amplify-shoefix-dev-210801-deployment/amplify-cfn-templates/interactions/shoefixlex-cloudformation-template.json",
                "logicalId": "interactionsshoefixlex"
            },
            "lastBuildTimeStamp": "2020-03-25T00:48:23.341Z",
            "lastPackageTimeStamp": "2020-03-25T00:48:25.130Z",
            "distZipFilename": "shoefixlex-504d2f39592f5442564d-build.zip",
            "lastPushDirHash": "qpoun/1RX0jz3ZYNLHticImDiiw="
        }
    }
}
waltermvp commented 4 years ago

I can send you the project via email or some other secure way if you need help reproducing it

ammarkarachi commented 4 years ago

@waltermvp Can you zip it and send over to amplify-cli@amazon.com

waltermvp commented 4 years ago

thank you, its sent. @ammarkarachi @kaustavghosh06

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

kaustavghosh06 commented 4 years ago

@waltermvp Are you still stuck with this issue?

stale[bot] commented 4 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.