amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

AWS mobile push failed #101

Closed nawwa closed 6 years ago

nawwa commented 6 years ago

Hello, I'm not sure if its an issue or not but i don't know where to ask.

My project has a cloud-api configured, some lambdas execute the code. I modified the lambda inside aws code editor, and i did a awsmobile pull

Now i try to push a new path (/fleet) to my cloud api with

awsmobile cloud-api configure -> edit api -> add path

But when I try to push the configuration i get this error, and i don't understand why.

project git:(master) ✗ awsmobile push

checking the backend contents
   building cloud-api
      zipping fleet
   done
   generating backend project content
   done
backend build artifacts are saved at: 
/home/nawwa/devel/final/project/awsmobilejs/.awsmobile/backend-build

preparing for backend project update: project-aws
   uploading fleet-20180413104155.zip
   upload Successful  fleet-20180413104155.zip
done

updating backend project: project-aws
Failed to update project project-aws
{ BadRequestException: The stack ****************MOBILEHUB-1635328995-Development/83a79b20-3cca-11e8-822a-504dcd6bf9fe' in Amazon CloudFormation has been modified outside of the Mobile Hub. This stage 'Development' can no longer be modified inside of Mobile Hub.
    at Object.extractError (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/json.js:48:27)
    at Request.extractError (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8)
    at Request.callListeners (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/usr/lib/node_modules/awsmobile-cli/node_modules/aws-sdk/lib/request.js:685:12)
  message: 'The stack \'***************************/MOBILEHUB-1635328995-Development/83a79b20-3cca-11e8-822a-504dcd6bf9fe\' in Amazon CloudFormation has been modified outside of the Mobile Hub. This stage \'Development\' can no longer be modified inside of Mobile Hub.',
  code: 'BadRequestException',
  time: 2018-04-13T08:42:31.574Z,
  requestId: '929d0110-3ef6-11e8-9eef-65de22b9c5e9',
  statusCode: 400,
  retryable: false,
  retryDelay: 20.08850526397483 }
UnleashedMind commented 6 years ago

Hi @nawwa , The mobile hub throws error because you modified the cloud-api feature outside of the mobile hub. (as printed out in the error message): "Amazon CloudFormation has been modified outside of the Mobile Hub. This stage 'Development' can no longer be modified inside of Mobile Hub"

nawwa commented 6 years ago

Thanks, yeah of course i saw that,. ! What 'outside of the mobile hub" means ? Because if I modify a lambda linked to the cloud-api (so inside of the mobile hub) i should be able to use 'awsmobile pull' to get the modifications..

It seems that if I modify the mobile hub project manually, the awsmobile cli is not able to sync properly when i use awmobile pull

For example : 1-Cloud API (api gateway) is enabled on the mobile hub project 2-I modify the cloud-api using the awsmobile cli (for example i add a path) 3-I run awsmobile push, everything works, the cli create the path and a lambda function with some nodejs code inside

Then :

4-I modify the lambda using aws lambda editor (aws website) 5-I use awsmobile pull to get the modification i just did 6-This is where my error occurs, after this i can't use push or pull

Is this normal ? maybe its a normal behaviour, just trying to figure it out

Thanks

VividKnife commented 6 years ago

This is a normal behavior, your stack was locked because of you modified the lambda out side of mobile hub(not using AWS Mobile Hub Console or AWSMobileCLI). By default, mobile hub don't want to override you changes. If you go to AWS Mobile Hub console -> your locked project -> CloudLogic, you will be asked to unlock your project.

nawwa commented 6 years ago

Ok got it :+1: Thanks guys

supermikol commented 5 years ago

I just unlocked and everything was deleted. Can someone explain to me how to undo this unlock?

elorzafe commented 5 years ago

When you unlock the feature there is a warning message that is saying that your changes are going to be overwritten, but it shouldn't delete the api just returned it to the state that was configured on Mobilehub

micahkatz commented 5 years ago

how do you unlock?

elorzafe commented 5 years ago

@micahkatz You have to go to the console to do that. Have you tried amplify-cli