amazon-archives / awsmobile-cli

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

awsmobile publish stops if a cloud-api is imported; does not deploy frontend #51

Closed ceich closed 6 years ago

ceich commented 6 years ago

I set up a MobileHub project a few days ago with an imported Cloud API, TokenGenerator. As expected, there is no code for this API pulled down by awsmobile pull. As not expected, awsmobile push does not work. I had been using awsmobile-cli@1.0.10, but just upgraded to 1.0.11: removed 12 packages and updated 4 packages in 4.274s

I get the same error:

$ awsmobile push
checking for local backend changes
      Warning: no codebase found for lambda function: TokenGenerator/{proxy+}: undefined
ceich commented 6 years ago

This is keeping me from publishing, which is a pain.

Update: I found the -f flag so I am not blocked from publishing the front end.

UnleashedMind commented 6 years ago

It was a bug and it's been fixed. please get the latest version 1.0.12

ceich commented 6 years ago

Do you think it'll work if there are a mix of MH-created and imported APIs?

UnleashedMind commented 6 years ago

the fix made sure that even if no backend update is needed, frontend publish is still executed. Please give it a try and let us know.

ceich commented 6 years ago

For some reason (perhaps due to having used older versions of the CLI before) it now thinks a backend update is required and still fails. Same error as above.

My most recent comment suggested that the push would still fail if a MH-created (and locally edited) API needed to push, but an imported (and not locally edited) API also existed.

ceich commented 6 years ago

I tried a pull before trying publish (to try to sync up state) but did not sync backend with #current-backend-info. Should I have?

ceich commented 6 years ago
$ diff -b -r awsmobilejs/{#current-backend-info,backend}
Only in awsmobilejs/#current-backend-info: aws-exports.js
Only in awsmobilejs/#current-backend-info: backend-details.json
Only in awsmobilejs/backend: cloud-api
diff -b -r awsmobilejs/#current-backend-info/mobile-hub-project.yml awsmobilejs/backend/mobile-hub-project.yml
9c9
<           api-arn: "arn:aws:execute-api:us-east-1:305905853980:w50y4cvwed"
---
>           api-arn: 'arn:aws:execute-api:us-east-1:305905853980:w50y4cvwed'
14c14
<           "/{proxy+}": !com.amazonaws.mobilehub.v0.Function {}
---
>           '/{proxy+}': !com.amazonaws.mobilehub.v0.Function {}
UnleashedMind commented 6 years ago

Yes, please execute awsmobile pull and sync backend with #current-backend-info

ceich commented 6 years ago

Makes no difference. Same diffs as above, and publish still wants to push.

ceich commented 6 years ago

Looking at backend-update.js, I understand why it wants to push (last push failed).

The problem is the push failing, not the decision that a push is needed. Go back to the original error: the tool does not seem to support an imported API.

UnleashedMind commented 6 years ago

We will notify our server side team on this issue

ceich commented 6 years ago

Update: I just realized the message above is not a fail but a warning (indeed push returns status 0), but nevertheless something about the imported API causes publish to not proceed to deploy the front end.

elorzafe commented 6 years ago

Hi @ceich I did reproduced the issue. We are working on a fix and planning to publish it ASAP.

Thanks

UnleashedMind commented 6 years ago

This is a bug, and it has been fixed. The fix will be released in the next version. Thanks for providing the information.

UnleashedMind commented 6 years ago

The latest update (v 1.0.13) should have resolved this issue.

ceich commented 6 years ago

Thanks, it seems to work for me. Warning is still in place for an expected situation, but the push/publish both run to completion.

I haven't tried with a backend that mixes imported and MH-created APIs.