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 with combination of manually created API and CLI created API #99

Closed LXensen closed 6 years ago

LXensen commented 6 years ago

CLI Version : 1.0.21 Similar Issues: #51

As mentioned in #51 there is still an issue with a combination of Mobile Hub generated APIs and Manually created APIs.

Steps to reproduce:

  1. Create an API 'manually' from API Gateway console ( or create Lambda function from Lambda console and add API Gateway as a trigger ).
  2. Add a resource and method. The integration type will be a Lambda function
  3. Deploy your API to a stage
  4. Find your project in Mobile Hub
  5. Select the Cloud Logic tile
  6. Select “Import existing API”
  7. Find and select your manually created API from above

pull the updated configuration using cli

awsmobile pull

The output of my mobile-hub-project.yml is:

    components:
      ManualAPI: !com.amazonaws.mobilehub.v0.API 
        attributes:
          api-arn: ‘***************************************’
          description: Manually Created API
          name: ManualAPI
          requires-signin: true
          sdk-generation-stage-name: Development
        paths:
          /manualapi: !com.amazonaws.mobilehub.v0.Function {}
  1. Create a new API via CLI

awsmobile cloud-api configure

  1. Follow steps to create new API
  2. Push update to Mobile Hub

Push fails

invalid lambda function name: ManualAPI/manualapi: tag:yaml.org,2002:js/undefined '' lambda function name can only contain alphanumeric characters: a-z A-Z 0-9 Warning: no codebase found for lambda function: ManualAPI/manualapi: tag:yaml.org,2002:js/undefined '' validation failed

The output of my mobile-hub-project.yml after creating new API is:

cloudlogic: !com.amazonaws.mobilehub.v0.CloudLogic
    components:  
      ManualAPI: !com.amazonaws.mobilehub.v0.API  
        attributes:  
          name: ManualAPI  
          requires-signin: true  
        paths:  
          /manualapi: !com.amazonaws.mobilehub.v0.Function  
            name: tag:yaml.org,2002:js/undefined ''  
            codeFilename: tag:yaml.org,2002:js/undefined ''
            handler: tag:yaml.org,2002:js/undefined ''
            enableCORS: tag:yaml.org,2002:js/undefined ''
            runtime: tag:yaml.org,2002:js/undefined ''
            environment: tag:yaml.org,2002:js/undefined ''
      CLIAPI: !com.amazonaws.mobilehub.v0.API 
        attributes:
          name: CLIAPI
          requires-signin: true
        paths:
          /cliapi: !com.amazonaws.mobilehub.v0.Function 
            name: CLIAPI
            codeFilename: uploads/CLIAPI.zip
            handler: lambda.handler
            enableCORS: true
            runtime: nodejs6.10
            environment: {}
          '/cliapi/{proxy+}': !com.amazonaws.mobilehub.v0.Function 
            name: CLIAPI
            codeFilename: uploads/CLIAPI.zip
            handler: lambda.handler
            enableCORS: true
            runtime: nodejs6.10
            environment: {}

There are numerous attributes of the ManualAPI component that have errors in their values.

elorzafe commented 6 years ago

Hi @LXensen this was fixed on v1.1.2

Feel free to reopen if you still have issues with this.

Thanks!