rackerlabs / lambda-uploader

Helps package and upload Python lambda functions to AWS
Apache License 2.0
270 stars 56 forks source link

Botocore parameter validation errors #150

Open lyanez-sitecompli opened 6 years ago

lyanez-sitecompli commented 6 years ago

I encounter parameter validation errors and haven't found much help getting an answer anywhere. My lambda.json file is as follows: { "name": "lambdaFunction", "description": "Function Description", "region": "us-east-1", "runtime": "python2.7", "handler": "lambda_function.lambda_handler", "role": "[ARNROLE]", "requirements": ["requests"], "ignore": [ "circle\\.yml$", "\\.git$", "/.*\\.pyc$" ], "timeout": 30, "memory": 512 }

`$ sudo lambda-uploader ./lambda --config ./lambda/lambda.json λ Building Package λ Uploading Package ⁉️ Unexpected error. Please report this traceback. Uploader: 1.2.0 Botocore: 1.2.3 Boto3: 1.3.22

Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/lambda_uploader/shell.py", line 193, in main _execute(args) File "/usr/lib/python2.7/site-packages/lambda_uploader/shell.py", line 102, in _execute upldr.upload(pkg) File "/usr/lib/python2.7/site-packages/lambda_uploader/uploader.py", line 144, in upload self.version = self.upload_new(pkg) File "/usr/lib/python2.7/site-packages/lambda_uploader/uploader.py", line 121, in upload_new TracingConfig=self._config.tracing, File "/usr/lib/python2.7/site-packages/botocore/client.py", line 310, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/lib/python2.7/site-packages/botocore/client.py", line 383, in _make_api_call api_params, operation_model, context=request_context) File "/usr/lib/python2.7/site-packages/botocore/client.py", line 436, in _convert_to_request_dict api_params, operation_model) File "/usr/lib/python2.7/site-packages/botocore/validate.py", line 273, in serialize_to_request raise ParamValidationError(report=report.generate_report()) ParamValidationError: Parameter validation failed: Unknown parameter in input: "TracingConfig", must be one of: FunctionName, Runtime, Role, Handler, Code, Description, Timeout, MemorySize, Publish Unknown parameter in input: "VpcConfig", must be one of: FunctionName, Runtime, Role, Handler, Code, Description, Timeout, MemorySize, Publish Unknown parameter in input: "Environment", must be one of: FunctionName, Runtime, Role, Handler, Code, Description, Timeout, MemorySize, Publish`

jarosser06 commented 6 years ago

It looks like the versions you are using for botocore and boto3 are older than the minimum required versions. Try upgrading both of those to the minimum https://github.com/rackerlabs/lambda-uploader/blob/master/setup.py#L8-L9

lyanez-sitecompli commented 6 years ago

Thank you for your quick response. It appears that those versions are not good at picking up the aws credentials I have set up. I have set up all ~/.aws/config, ~/.aws/credentials, ~/.boto, and even environmental variables AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_DEFAULT_REGION


sudo lambda-uploader ./lambda --config ./lambda/lambda.json
λ Building Package
λ Uploading Package
⁉️ Unexpected error. Please report this traceback.
Uploader: 1.2.0
Botocore: 1.4.7
Boto3: 1.7.47

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/lambda_uploader/shell.py", line 193, in main
    _execute(args)
  File "/usr/lib/python2.7/site-packages/lambda_uploader/shell.py", line 102, in _execute
    upldr.upload(pkg)
  File "/usr/lib/python2.7/site-packages/lambda_uploader/uploader.py", line 144, in upload
    self.version = self.upload_new(pkg)
  File "/usr/lib/python2.7/site-packages/lambda_uploader/uploader.py", line 121, in upload_new
    TracingConfig=self._config.tracing,
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 312, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 592, in _make_api_call
    operation_model, request_dict)
  File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 141, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 166, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 150, in create_request
    operation_name=operation_model.name)
  File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/usr/lib/python2.7/site-packages/botocore/signers.py", line 154, in sign
    auth.add_auth(request)
  File "/usr/lib/python2.7/site-packages/botocore/auth.py", line 352, in add_auth
    raise NoCredentialsError
NoCredentialsError: Unable to locate credentials
jarosser06 commented 6 years ago

Is there a particular reason you are running it with sudo? The credentials are likely not found because sudo doesn't usually default to using the user environment variables.