Amplify-cli: TypeError: Cannot read property 'lastPushTimeStamp' of undefined

Created on 12 Jul 2020  路  9Comments  路  Source: aws-amplify/amplify-cli

Note: If your question is regarding the AWS Amplify Console service, please log it in the
official AWS Amplify Console forum

Which Category is your question related to?

amplify status
TypeError: Cannot read property 'lastPushTimeStamp' of undefined

Amplify CLI Version 4.24.0

You can use amplify -v to check the amplify cli version on your system

What AWS Services are you utilizing?

I am in the set up stage of adding an api using Lambda and and DynamoDB

Provide additional details e.g. code snippets

I have tried adding an api for a REST service that will write to a DynamoDB table. I keep getting this error. Let me know if you need any more details.

Thanks!

here is my amplify-meta.json file:

{
    "providers": {
        "awscloudformation": {
            "AuthRoleName": "amplify-montessorinotes-dev-115308-authRole",
            "UnauthRoleArn": "arn:aws:iam::788792955735:role/amplify-montessorinotes-dev-115308-unauthRole",
            "AuthRoleArn": "arn:aws:iam::788792955735:role/amplify-montessorinotes-dev-115308-authRole",
            "Region": "us-east-1",
            "DeploymentBucketName": "amplify-montessorinotes-dev-115308-deployment",
            "UnauthRoleName": "amplify-montessorinotes-dev-115308-unauthRole",
            "StackName": "amplify-montessorinotes-dev-115308",
            "StackId": "arn:aws:cloudformation:us-east-1:788792955735:stack/amplify-montessorinotes-dev-115308/2ac52890-c460-11ea-addb-0eb21ddd4aff",
            "AmplifyAppId": "d24xh96txih9mk"
        }
    },
    "storage": {
        "childTable": {
            "service": "DynamoDB",
            "providerPlugin": "awscloudformation"
        }
    },
    "function": {
        "childLambda": {
            "build": true,
            "providerPlugin": "awscloudformation",
            "service": "Lambda",
            "dependsOn": [
                {
                    "category": "storage",
                    "resourceName": "childTable",
                    "attributes": [
                        "Name",
                        "Arn"
                    ],
                    "attributeEnvMap": {
                        "Name": "TABLE_NAME",
                        "Arn": "TABLE_ARN"
                    }
                },
                {
                    "category": "storage",
                    "resourceName": "childTable",
                    "attributes": [
                        "Name",
                        "Arn"
                    ]
                }
            ]
        }
    },
    "auth": {
        "cognito4e637321": {
            "service": "Cognito",
            "providerPlugin": "awscloudformation"
        }
    },
    "api": {
        "childApi": {
            "service": "API Gateway",
            "providerPlugin": "awscloudformation",
            "dependsOn": [
                {
                    "category": "function",
                    "resourceName": "child",
                    "attributes": [
                        "Name",
                        "Arn"
                    ]
                }
            ]
        }
    }
}
api-rest bug

Most helpful comment

I have the same issue.
When I set "friendly name" and "function name" to the same value, this error does NOT occur.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test <------

But When I set different values to these, the "Cannot read property 'lastPushTimeStamp' of undefined" error occurs.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test2 <------

$ amplify status

Current Environment: prod

Cannot read property 'lastPushTimeStamp' of undefined

Amplify CLI Version 4.24.3
mac OS Catalina 10.15.6

All 9 comments

i am having the exact same issue. if you figure it out comment plz and ill do the same.

i found that if i unbundled the process and added auth, then storage, then the function, then finally the rest api i avoided this error. i dont know if anything will be different because of this, but it was the best i could do short of changing the code in @aws-amplify/cli that triggers the error.

thank you! I was able to add the auth and storage and then the function. All seems to be well now.

Did your amplify-meta.json change after you followed these steps?

I have the same issue.
When I set "friendly name" and "function name" to the same value, this error does NOT occur.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test <------

But When I set different values to these, the "Cannot read property 'lastPushTimeStamp' of undefined" error occurs.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test2 <------

$ amplify status

Current Environment: prod

Cannot read property 'lastPushTimeStamp' of undefined

Amplify CLI Version 4.24.3
mac OS Catalina 10.15.6

@reinhal Your API Gateway depends on a Lambda called "child" under "resourceName", which does not exist - only "childLambda" does. So CLI has "child" as undefined which cannot get its 'lastPushTimeStamp'.

I have the same issue.
When I set "friendly name" and "function name" to the same value, this error does NOT occur.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test <------

But When I set different values to these, the "Cannot read property 'lastPushTimeStamp' of undefined" error occurs.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test2 <------

$ amplify status

Current Environment: prod

Cannot read property 'lastPushTimeStamp' of undefined

Amplify CLI Version 4.24.3
mac OS Catalina 10.15.6

@eijikominami It's working.

I have the same issue.
When I set "friendly name" and "function name" to the same value, this error does NOT occur.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test <------

But When I set different values to these, the "Cannot read property 'lastPushTimeStamp' of undefined" error occurs.

$ amplify api add
? Please select from one of the below mentioned services: REST
? Provide a friendly name for your resource to be used as a label for this category in the project: xxxxxxx
? Provide a path (e.g., /book/{isbn}): /items
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: test <------
? Provide the AWS Lambda function name: test2 <------

$ amplify status

Current Environment: prod

Cannot read property 'lastPushTimeStamp' of undefined

Amplify CLI Version 4.24.3
mac OS Catalina 10.15.6

This works for me and I am able to publish; however, once I do publish, the "API" column of the AWS Amplify console appears empty, and when I click on the created API Gateway resource in the Lambda console, it gives the following error: The API with ID xxxxxxxxxx doesn鈥檛 include a resource with path /* having an integration arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:X on the ANY method.

@reinhal I apologize for getting back to you so late. I am testing this with 4.29.7 and I couldn't reproduce but I see that it exists with 4.24.3. Do not hesitate to open a new issue or reopen this one if you come across other issues

Was this page helpful?
0 / 5 - 0 ratings