Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1595 was fixed but it exposed another problem with put-integration #1605

Closed
bradmurray opened this issue Oct 29, 2015 · 5 comments
Closed
Labels
bug This issue is a bug.

Comments

@bradmurray
Copy link

(I put this comment in #1595 but it's closed so I wanted to open a new issue)

I installed the develop branch and the code that should be working for put-integration but it is giving me the following error now:

A client error (BadRequestException) occurred when calling the PutIntegration operation: Enumeration value for HttpMethod must be non-empty

It think there is a typo somewhere in that "HttpMethod" should be "httpMethod" because that's the parameter that the CLI is expecting.

If have tried using the regular command-line method as well as the --cli-input-json format and the error is the same.

Here is the debug output:

2015-10-29 06:02:31,937 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.9.1 Python/2.7.10 Darwin/15.0.0 botocore/1.3.1
2015-10-29 06:02:31,937 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['apigateway', 'put-integration', '--rest-api-id', 'j7p2wzqtzb', '--resource-id', 'ueafsx', '--http-method', 'GET', '--type', 'AWS', '--uri', 'rn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:486254463964:function:servicetest/invocations', '--request-templates', '{ "SessionID": ".params().header.SessionID", "URL": ".params().path.Res0/.params().path.ID0/.params().path.Res1/.params().path.ID1/.params().path.Res2", "HTTPMethod": ".httpMethod" }', '--cache-namespace', 'ueafsx', '--cache-key-parameters', '[]', '--debug']
2015-10-29 06:02:31,937 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x10fafe410>
2015-10-29 06:02:31,937 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider at 0x10fac2b18>
2015-10-29 06:02:31,937 - MainThread - botocore.credentials - DEBUG - Skipping environment variable credential check because profile name was explicitly set.
2015-10-29 06:02:31,955 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.apigateway: calling handler <function register_retries_for_service at 0x10f5c2aa0>
2015-10-29 06:02:31,955 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: apigateway
2015-10-29 06:02:31,957 - MainThread - botocore.hooks - DEBUG - Event building-command-table.apigateway: calling handler <function add_waiters at 0x10facf938>
2015-10-29 06:02:31,959 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'rest-api-id', <awscli.arguments.CLIArgument object at 0x110037c10>), (u'resource-id', <awscli.arguments.CLIArgument object at 0x110037c50>), (u'http-method', <awscli.arguments.CLIArgument object at 0x110037c90>), (u'type', <awscli.arguments.CLIArgument object at 0x110037cd0>), (u'integration-http-method', <awscli.arguments.CLIArgument object at 0x110037d10>), (u'uri', <awscli.arguments.CLIArgument object at 0x110037d50>), (u'credentials', <awscli.arguments.CLIArgument object at 0x110037d90>), (u'request-parameters', <awscli.arguments.CLIArgument object at 0x110037dd0>), (u'request-templates', <awscli.arguments.CLIArgument object at 0x110037e10>), (u'cache-namespace', <awscli.arguments.CLIArgument object at 0x110037e50>), (u'cache-key-parameters', <awscli.arguments.ListArgument object at 0x110037e90>)])
2015-10-29 06:02:31,959 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.apigateway.put-integration: calling handler <function add_streaming_output_arg at 0x10f853ed8>
2015-10-29 06:02:31,959 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.apigateway.put-integration: calling handler <function add_cli_input_json at 0x10fabbde8>
2015-10-29 06:02:31,959 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.apigateway.put-integration: calling handler <function unify_paging_params at 0x10f980050>
2015-10-29 06:02:31,960 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.apigateway.put-integration: calling handler <function add_generate_skeleton at 0x10fac2398>
2015-10-29 06:02:31,960 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.apigateway.put-integration: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x110037f10>>
2015-10-29 06:02:31,960 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.apigateway.put-integration: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x110037ed0>>
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.rest-api-id: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,962 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'j7p2wzqtzb' for parameter "rest_api_id": u'j7p2wzqtzb'
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.resource-id: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,962 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'ueafsx' for parameter "resource_id": u'ueafsx'
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.http-method: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,962 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'GET' for parameter "http_method": u'GET'
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.type: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,962 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,962 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'AWS' for parameter "type": u'AWS'
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.integration-http-method: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.uri: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,963 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'rn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:486254463964:function:servicetest/invocations' for parameter "uri": u'rn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:486254463964:function:servicetest/invocations'
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.credentials: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.request-parameters: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.request-templates: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,963 - MainThread - awscli.argprocess - DEBUG - Param request_templates looks like JSON, not considered for param shorthand.
2015-10-29 06:02:31,963 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'{ "SessionID": ".params().header.SessionID", "URL": ".params().path.Res0/.params().path.ID0/.params().path.Res1/.params().path.ID1/.params().path.Res2", "HTTPMethod": ".httpMethod" }' for parameter "request_templates": OrderedDict([(u'SessionID', u'.params().header.SessionID'), (u'URL', u'.params().path.Res0/.params().path.ID0/.params().path.Res1/.params().path.ID1/.params().path.Res2'), (u'HTTPMethod', u'.httpMethod')])
2015-10-29 06:02:31,963 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.cache-namespace: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,964 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'ueafsx' for parameter "cache_namespace": u'ueafsx'
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.cache-key-parameters: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.apigateway.put-integration: calling handler <awscli.argprocess.ParamShorthand object at 0x10fb06810>
2015-10-29 06:02:31,964 - MainThread - awscli.argprocess - DEBUG - Param cache_key_parameters looks like JSON, not considered for param shorthand.
2015-10-29 06:02:31,964 - MainThread - awscli.arguments - DEBUG - Unpacked value of [u'[]'] for parameter "cache_key_parameters": []
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.cli-input-json: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.apigateway.put-integration.generate-cli-skeleton: calling handler <function uri_param at 0x10f83d938>
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event calling-command.apigateway.put-integration: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x110037ed0>>
2015-10-29 06:02:31,964 - MainThread - botocore.hooks - DEBUG - Event calling-command.apigateway.put-integration: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x110037f10>>
2015-10-29 06:02:31,964 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2015-10-29 06:02:31,964 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2015-10-29 06:02:31,964 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2015-10-29 06:02:31,964 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: config-file
2015-10-29 06:02:31,965 - MainThread - botocore.credentials - INFO - Credentials found in config file: ~/.aws/config
2015-10-29 06:02:31,966 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: apigateway
2015-10-29 06:02:31,968 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.apigateway: calling handler <function add_generate_presigned_url at 0x10f5906e0>
2015-10-29 06:02:32,096 - MainThread - botocore.endpoint - DEBUG - Setting apigateway timeout as (60, 60)
2015-10-29 06:02:32,098 - MainThread - botocore.hooks - DEBUG - Event before-call.apigateway.PutIntegration: calling handler <function add_accept_header at 0x10f5c5230>
2015-10-29 06:02:32,098 - MainThread - botocore.endpoint - DEBUG - Making request for <botocore.model.OperationModel object at 0x11007c510> (verify_ssl=True) with params: {'body': '{"requestTemplates": {"URL": ".params().path.Res0/.params().path.ID0/.params().path.Res1/.params().path.ID1/.params().path.Res2", "HTTPMethod": ".httpMethod", "SessionID": ".params().header.SessionID"}, "uri": "rn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:486254463964:function:servicetest/invocations", "type": "AWS", "cacheNamespace": "ueafsx", "cacheKeyParameters": []}', 'url': u'https://apigateway.us-west-2.amazonaws.com/restapis/j7p2wzqtzb/resources/ueafsx/methods/GET/integration', 'headers': {'Accept': 'application/json', 'User-Agent': 'aws-cli/1.9.1 Python/2.7.10 Darwin/15.0.0 botocore/1.3.1'}, 'query_string': {}, 'url_path': u'/restapis/j7p2wzqtzb/resources/ueafsx/methods/GET/integration', 'method': u'PUT'}
2015-10-29 06:02:32,098 - MainThread - botocore.hooks - DEBUG - Event request-created.apigateway.PutIntegration: calling handler <bound method APIGateway._sign_request of <botocore.client.APIGateway object at 0x110089350>>
2015-10-29 06:02:32,098 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2015-10-29 06:02:32,099 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
PUT
/restapis/j7p2wzqtzb/resources/ueafsx/methods/GET/integration

accept:application/json
host:apigateway.us-west-2.amazonaws.com
user-agent:aws-cli/1.9.1 Python/2.7.10 Darwin/15.0.0 botocore/1.3.1
x-amz-date:20151029T100232Z

accept;host;user-agent;x-amz-date
39d0bd12f462b8eb97e4934af898a1bba6a1b348ab5256e8027a95c89d525bb2
2015-10-29 06:02:32,099 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20151029T100232Z
20151029/us-west-2/apigateway/aws4_request
e5b07fe7b45117991153963aff92498a227f3436d99d8a4b0f57c2f143a75571
2015-10-29 06:02:32,099 - MainThread - botocore.auth - DEBUG - Signature:
ec70a63b2de0e064a89f9cb43316c5d1d2a33abc0f4bd9692408b492a8dfd62f
2015-10-29 06:02:32,103 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [PUT]>
2015-10-29 06:02:32,104 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): apigateway.us-west-2.amazonaws.com
2015-10-29 06:02:32,939 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "PUT /restapis/j7p2wzqtzb/resources/ueafsx/methods/GET/integration HTTP/1.1" 400 65
2015-10-29 06:02:32,940 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-requestid': '2c21e7a1-7e24-11e5-870c-2924212617d5', 'content-length': '65', 'date': 'Thu, 29 Oct 2015 10:02:32 GMT', 'nncoection': 'close', 'content-type': 'application/json', 'x-amzn-errortype': 'BadRequestException'}
2015-10-29 06:02:32,940 - MainThread - botocore.parsers - DEBUG - Response body:
{"message":"Enumeration value for HttpMethod must be non-empty"}

2015-10-29 06:02:32,941 - MainThread - botocore.hooks - DEBUG - Event needs-retry.apigateway.PutIntegration: calling handler <botocore.retryhandler.RetryHandler object at 0x10fe12a10>
2015-10-29 06:02:32,941 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2015-10-29 06:02:32,941 - MainThread - botocore.hooks - DEBUG - Event after-call.apigateway.PutIntegration: calling handler <awscli.errorhandler.ErrorHandler object at 0x10fb12510>
2015-10-29 06:02:32,941 - MainThread - awscli.errorhandler - DEBUG - HTTP Response Code: 400
2015-10-29 06:02:32,941 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/Users/bmurray/Desktop/aws-cli-develop/awscli/clidriver.py", line 184, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/Users/bmurray/Desktop/aws-cli-develop/awscli/clidriver.py", line 369, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/Users/bmurray/Desktop/aws-cli-develop/awscli/clidriver.py", line 538, in __call__
    call_parameters, parsed_globals)
  File "/Users/bmurray/Desktop/aws-cli-develop/awscli/clidriver.py", line 662, in invoke
    **parameters)
  File "/Users/bmurray/Desktop/aws-cli-develop/src/botocore/botocore/client.py", line 310, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/bmurray/Desktop/aws-cli-develop/src/botocore/botocore/client.py", line 391, in _make_api_call
    model=operation_model
  File "/Users/bmurray/Desktop/aws-cli-develop/src/botocore/botocore/hooks.py", line 226, in emit
    return self._emit(event_name, kwargs)
  File "/Users/bmurray/Desktop/aws-cli-develop/src/botocore/botocore/hooks.py", line 209, in _emit
    response = handler(**kwargs)
  File "/Users/bmurray/Desktop/aws-cli-develop/awscli/errorhandler.py", line 70, in __call__
    http_status_code=http_response.status_code)
ClientError: A client error (BadRequestException) occurred when calling the PutIntegration operation: Enumeration value for HttpMethod must be non-empty
2015-10-29 06:02:32,946 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

A client error (BadRequestException) occurred when calling the PutIntegration operation: Enumeration value for HttpMethod must be non-empty
@bradmurray
Copy link
Author

To avoid some confusion, I am passing a variable called HTTPMethod to my Lambda function so that my function can receive the method. That logic works when I put it in via the web.

@quiver
Copy link
Contributor

quiver commented Oct 29, 2015

Same here.
I ran commands like this

$ aws apigateway put-integration --rest-api-id $REST_API_ID --resource-id $RESOURCE --http-method GET --type AWS --uri $LAMBDA_ARN ... A client error (BadRequestException) occurred when calling the PutIntegration operation: Enumeration value for HttpMethod must be non-empty

@kyleknap
Copy link
Contributor

It looks like an issue with botocore's serializer. Also (this will not will not work currently) you will need to specify a --integration-http-method as well when running a put-integration command or you will get the same exception when specifying --type AWS.

@quiver
Copy link
Contributor

quiver commented Oct 30, 2015

@kyleknap thanks for your feedback. It's working fine now.

$ aws apigateway put-integration --rest-api-id $REST_API_ID --resource-id "dummy" --http-method GET --type AWS --uri "arn:aws:apigateway:ap-northeast-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-northeast-1:1234:function:GetHelloWorld/invocations" --integration-http-method GET
{
    "httpMethod": "GET",
    "type": "AWS",
    "uri": "arn:aws:apigateway:ap-northeast-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-northeast-1:1234:function:GetHelloWorld/invocations",
    "cacheNamespace": "dummy"
}

@kyleknap
Copy link
Contributor

Awesome. Good to hear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants