amplify-cli: Amplify mock fails to create local tables

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

How did you install the Amplify CLI?

npm -g

If applicable, what version of Node.js are you using?

12.13.1

Amplify CLI Version

4.51.2

What operating system are you using?

Mac M1

Amplify Categories

api

Amplify Commands

Not applicable

Describe the bug

After running amplify mock api, amplify fails to compile the Graph schema even though says has done it successfully, after a while ( like 10 mins), it does not make a connection with the endpoint. My internet connection is very stable, tried several times but no luck.

Screenshot 2021-05-23 at 23 32 16

Expected behavior

I expect amplify to create the local tables and point out to the local URL where I can add mutations and queries

Reproduction steps

  1. npx create-react-app test
  2. amplify init
  3. amplify add api (Api key was selected)
  4. amplify mock api

GraphQL schema(s)


type Blog @model {
  id: ID!
  name: String!
  posts: [Post] @connection(name: "BlogPosts")
}
type Post @model {
  id: ID!
  title: String!
  blog: Blog @connection(name: "BlogPosts")
  comments: [Comment] @connection(name: "PostComments")
}
type Comment @model {
  id: ID!
  content: String
  post: Post @connection(name: "PostComments")
}

Log output

2021-05-26T15:41:33.724Z|info : amplify mock mock  
2021-05-26T20:21:24.975Z|info : amplify version core  
2021-05-26T20:27:57.101Z|info : amplify version core  
2021-05-26T20:32:45.452Z|info : amplify init core  
2021-05-26T20:33:34.250Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"])
2021-05-26T20:33:34.253Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-2"}])
2021-05-26T20:33:34.253Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["default"])
2021-05-26T20:33:34.266Z|info : amplify-provider-awscloudformation.amplify-service-permission-check.checkAmplifyServiceIAMPermission.amplifyClient.listApps([])
2021-05-26T20:33:35.120Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.createApp([{"name":"[***]st","environmentVariables":{"_LIVE_PACKAGE_UPDATES":"[{\"pkg\":\"@aws-amplify/cli\",\"type\":\"npm\",\"version\":\"latest\"}]"}}])
2021-05-26T20:33:37.298Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]umm09j","environmentName":"[***]ev"}])
2021-05-26T20:33:38.079Z|error : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]umm09j","environmentName":"[***]ev"}])
NotFoundException: BackendEnvironment dev does not exist.
2021-05-26T20:33:38.080Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]umm09j","environmentName":"[***]ev","stackName":"[***]ify-[***]st-[***]ev-[***]334","deploymentArtifacts":"amplify-test-dev-213334-deployment"}])
2021-05-26T20:33:38.819Z|info : amplify-provider-awscloudformation.aws-cfn.cfnModel.createStack([{"StackName":"[***]ify-[***]st-[***]ev-[***]334","Capabilities":["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],"TemplateBody":"{\"AWSTemplateFormatVersion\":\"2010-09-09\",\"Description\":\"Root Stack for AWS Amplify CLI\",\"Parameters\":{\"[***]cketName\":{\"Description\":\"Name of the common deployment bucket provided by the parent stack\",\"Type\":\"String\",\"Default\":\"DeploymentBucket\"},\"[***]eName\":{\"Type\":\"String\",\"Default\":\"AuthRoleName\"},\"[***]leName\":{\"Type\":\"String\",\"Default\":\"UnauthRoleName\"}},\"Resources\":{\"DeploymentBucket\":{\"Type\":\"AWS::S3::Bucket\",\"DeletionPolicy\":\"Retain\",\"Properties\":{\"BucketName\":{\"Ref\":\"DeploymentBucketName\"},\"BucketEncryption\":{\"ServerSideEncryptionConfiguration\":[{\"ServerSideEncryptionByDefault\":{\"SSEAlgorithm\":\"AES256\"}}]}}},\"AuthRole\":{\"Type\":\"AWS::IAM::Role\",\"Properties\":{\"RoleName\":{\"Ref\":\"AuthRoleName\"},\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Deny\",\"Principal\":{\"Federated\":\"cognito-identity.amazonaws.com\"},\"Action\":\"sts:AssumeRoleWithWebIdentity\"}]}}},\"UnauthRole\":{\"Type\":\"AWS::IAM::Role\",\"Properties\":{\"RoleName\":{\"Ref\":\"UnauthRoleName\"},\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Deny\",\"Principal\":{\"Federated\":\"cognito-identity.amazonaws.com\"},\"Action\":\"sts:AssumeRoleWithWebIdentity\"}]}}}},\"Outputs\":{\"Region\":{\"Description\":\"CloudFormation provider root stack Region\",\"Value\":{\"Ref\":\"AWS::Region\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-Region\"}}},\"StackName\":{\"Description\":\"CloudFormation provider root stack ID\",\"Value\":{\"Ref\":\"AWS::StackName\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-StackName\"}}},\"StackId\":{\"Description\":\"CloudFormation provider root stack name\",\"Value\":{\"Ref\":\"AWS::StackId\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-StackId\"}}},\"DeploymentBucketName\":{\"Description\":\"CloudFormation provider root stack deployment bucket name\",\"Value\":{\"Ref\":\"DeploymentBucketName\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-DeploymentBucketName\"}}},\"AuthRoleArn\":{\"Value\":{\"Fn::GetAtt\":[\"AuthRole\",\"Arn\"]}},\"UnauthRoleArn\":{\"Value\":{\"Fn::GetAtt\":[\"UnauthRole\",\"Arn\"]}},\"AuthRoleName\":{\"Value\":{\"Ref\":\"AuthRole\"}},\"UnauthRoleName\":{\"Value\":{\"Ref\":\"UnauthRole\"}}}}","Parameters":[{"ParameterKey":"DeploymentBucketName","ParameterValue":"amplify-test-dev-213334-deployment"},{"ParameterKey":"AuthRoleName","ParameterValue":"amplify-test-dev-213334-authRole"},{"ParameterKey":"UnauthRoleName","ParameterValue":"amplify-test-dev-213334-unauthRole"}],"Tags":[{"Key":"[***]tack","Value":"dev"},{"Key":"[***]ication","Value":"test"}]}])
2021-05-26T20:33:40.234Z|info : amplify-provider-awscloudformation.aws-cfn.cfnModel.createStack([{"StackName":"[***]ify-[***]st-[***]ev-[***]334","Capabilities":["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],"TemplateBody":"{\"AWSTemplateFormatVersion\":\"2010-09-09\",\"Description\":\"Root Stack for AWS Amplify CLI\",\"Parameters\":{\"[***]cketName\":{\"Description\":\"Name of the common deployment bucket provided by the parent stack\",\"Type\":\"String\",\"Default\":\"DeploymentBucket\"},\"[***]eName\":{\"Type\":\"String\",\"Default\":\"AuthRoleName\"},\"[***]leName\":{\"Type\":\"String\",\"Default\":\"UnauthRoleName\"}},\"Resources\":{\"DeploymentBucket\":{\"Type\":\"AWS::S3::Bucket\",\"DeletionPolicy\":\"Retain\",\"Properties\":{\"BucketName\":{\"Ref\":\"DeploymentBucketName\"},\"BucketEncryption\":{\"ServerSideEncryptionConfiguration\":[{\"ServerSideEncryptionByDefault\":{\"SSEAlgorithm\":\"AES256\"}}]}}},\"AuthRole\":{\"Type\":\"AWS::IAM::Role\",\"Properties\":{\"RoleName\":{\"Ref\":\"AuthRoleName\"},\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Deny\",\"Principal\":{\"Federated\":\"cognito-identity.amazonaws.com\"},\"Action\":\"sts:AssumeRoleWithWebIdentity\"}]}}},\"UnauthRole\":{\"Type\":\"AWS::IAM::Role\",\"Properties\":{\"RoleName\":{\"Ref\":\"UnauthRoleName\"},\"AssumeRolePolicyDocument\":{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"\",\"Effect\":\"Deny\",\"Principal\":{\"Federated\":\"cognito-identity.amazonaws.com\"},\"Action\":\"sts:AssumeRoleWithWebIdentity\"}]}}}},\"Outputs\":{\"Region\":{\"Description\":\"CloudFormation provider root stack Region\",\"Value\":{\"Ref\":\"AWS::Region\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-Region\"}}},\"StackName\":{\"Description\":\"CloudFormation provider root stack ID\",\"Value\":{\"Ref\":\"AWS::StackName\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-StackName\"}}},\"StackId\":{\"Description\":\"CloudFormation provider root stack name\",\"Value\":{\"Ref\":\"AWS::StackId\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-StackId\"}}},\"DeploymentBucketName\":{\"Description\":\"CloudFormation provider root stack deployment bucket name\",\"Value\":{\"Ref\":\"DeploymentBucketName\"},\"Export\":{\"Name\":{\"Fn::Sub\":\"${AWS::StackName}-DeploymentBucketName\"}}},\"AuthRoleArn\":{\"Value\":{\"Fn::GetAtt\":[\"AuthRole\",\"Arn\"]}},\"UnauthRoleArn\":{\"Value\":{\"Fn::GetAtt\":[\"UnauthRole\",\"Arn\"]}},\"AuthRoleName\":{\"Value\":{\"Ref\":\"AuthRole\"}},\"UnauthRoleName\":{\"Value\":{\"Ref\":\"UnauthRole\"}}}}","Parameters":[{"ParameterKey":"DeploymentBucketName","ParameterValue":"amplify-test-dev-213334-deployment"},{"ParameterKey":"AuthRoleName","ParameterValue":"amplify-test-dev-213334-authRole"},{"ParameterKey":"UnauthRoleName","ParameterValue":"amplify-test-dev-213334-unauthRole"}],"Tags":[{"Key":"[***]tack","Value":"dev"},{"Key":"[***]ication","Value":"test"}]}])
2021-05-26T20:33:45.258Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:33:46.140Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]23:stack/[***]ify-[***]st-[***]ev-[***]334/[***]da20-[***]61-[***]eb-[***]5c-[***]df3ab"}])
2021-05-26T20:33:50.253Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:33:51.101Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]23:stack/[***]ify-[***]st-[***]ev-[***]334/[***]da20-[***]61-[***]eb-[***]5c-[***]df3ab"}])
2021-05-26T20:33:55.262Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:33:56.129Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]23:stack/[***]ify-[***]st-[***]ev-[***]334/[***]da20-[***]61-[***]eb-[***]5c-[***]df3ab"}])
2021-05-26T20:34:00.258Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:34:01.144Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]23:stack/[***]ify-[***]st-[***]ev-[***]334/[***]da20-[***]61-[***]eb-[***]5c-[***]df3ab"}])
2021-05-26T20:34:05.263Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:34:06.114Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]rmation:us-[***]st-[***]23:stack/[***]ify-[***]st-[***]ev-[***]334/[***]da20-[***]61-[***]eb-[***]5c-[***]df3ab"}])
2021-05-26T20:34:10.267Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]st-[***]ev-[***]334"}])
2021-05-26T20:34:12.122Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"])
2021-05-26T20:34:12.122Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-2"}])
2021-05-26T20:34:12.123Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["default"])
2021-05-26T20:34:12.131Z|info : amplify-provider-awscloudformation.attach-backend.storeCurrentCloudBackend.s3.uploadFile([{"Key":"[***]rent-[***]ud-[***]d.zip"}])
2021-05-26T20:34:12.136Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]st-[***]ev-[***]334-[***]ment"}])
2021-05-26T20:34:13.158Z|info : amplify-provider-awscloudformation.attach-backend.uploadFile.s3.uploadFile([{"Key":"[***]ify-[***]json"}])
2021-05-26T20:34:13.159Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]st-[***]ev-[***]334-[***]ment"}])
2021-05-26T20:36:34.380Z|info : amplify add api  
2021-05-26T20:42:58.193Z|info : amplify add api  
2021-05-26T20:47:15.262Z|info : amplify api mock  
2021-05-26T20:48:12.056Z|info : amplify api mock 


Additional information

This issue is somehow related to this but it was closed

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

@danabrams are you still willing to make a PR to our docs site to add a note for M1 Mac users?

Yes, doing so now.

UPDATE: It’s here