nficano / python-lambda

A toolkit for developing and deploying serverless Python code in AWS Lambda.
ISC License
1.5k stars 229 forks source link

`lambda deploy` is not working #722

Closed supreme-core closed 6 months ago

supreme-core commented 7 months ago

Env: Linux Ubuntu 22

Below is a script of commands to set up environment and run deploy

#!/bin/bash

mkdir lambda_func2 && cd lambda_func2
# python3 -m venv ./.venv
# source ./.venv/bin/activate
# pip install python-lambda
lambda init 
# supply aws access key and secret access key to config.yaml
# change the region to your region inside config.yaml
# optional: change the function name inside config.yaml
lambda invoke -v
lambda deploy 

Using the script above will output an error message

botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the GetFunction operation: The security token included in the request is invalid.

Here's the full StackTrace

Bundling: 'install.sh'
Bundling: 'event.json'
Bundling: 'service.py'
Traceback (most recent call last):
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/bin/lambda", line 213, in <module>
    cli()
  File "/home/adminUse/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/bin/lambda", line 117, in deploy
    aws_lambda.deploy(
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/aws_lambda/aws_lambda.py", line 136, in deploy
    existing_config = get_function_config(cfg)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/aws_lambda/aws_lambda.py", line 825, in get_function_config
    return client.get_function(FunctionName=function_name)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/botocore/client.py", line 553, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/adminUser/Downloads/examples/design/Examples/lambda_func2/.venv/lib/python3.10/site-packages/botocore/client.py", line 1009, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the GetFunction operation: The security token included in the request is invalid.
carslons commented 7 months ago

Hi Wondering whether you've solved this as I'm having the same issue.

supreme-core commented 6 months ago

Didn't receive a reply from the author. Closing it.