You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending file (postman or frontend) to backend lambda through API Gateway I'm getting an error while doing local testing with sam local start-api UnicodeDecodeError while processing HTTP request: 'utf-8' codec can't decode byte 0xb5 in position 473: invalid start byte.
While the deployed application behave normally with an actual API Gateway and Lambda
○ → sam local start-api --debug
2025-03-10 09:20:34,406 | No config file found in this directory.
2025-03-10 09:20:34,408 | OSError occurred while reading TOML file: [Errno 2] No such file or directory: '/Users/mjkubba/workspace/debug/samconfig.toml'
2025-03-10 09:20:34,409 | Config file location: /Users/mjkubba/workspace/debug/samconfig.toml
2025-03-10 09:20:34,410 | Config file '/Users/mjkubba/workspace/debug/samconfig.toml' does not exist
2025-03-10 09:20:34,412 | Using SAM Template at /Users/mjkubba/workspace/debug/template.yaml
2025-03-10 09:20:34,430 | OSError occurred while reading TOML file: [Errno 2] No such file or directory: '/Users/mjkubba/workspace/debug/samconfig.toml'
2025-03-10 09:20:34,431 | Using config file: samconfig.toml, config environment: default
2025-03-10 09:20:34,431 | Expand command line arguments to:
2025-03-10 09:20:34,431 | --template_file=/Users/mjkubba/workspace/debug/template.yaml --host=127.0.0.1 --port=3000 --static_dir=public
--layer_cache_basedir=/Users/mjkubba/.aws-sam/layers-pkg --container_host=localhost --container_host_interface=127.0.0.1
2025-03-10 09:20:34,492 | local start-api command is called
2025-03-10 09:20:34,726 | No Parameters detected in the template
2025-03-10 09:20:34,745 | There is no customer defined id or cdk path defined for resource gappbeapi, so we will use the resource logical id as the resource id
2025-03-10 09:20:34,745 | There is no customer defined id or cdk path defined for resource gappbe, so we will use the resource logical id as the resource id
2025-03-10 09:20:34,746 | 0 stacks found in the template
2025-03-10 09:20:34,746 | No Parameters detected in the template
2025-03-10 09:20:34,756 | There is no customer defined id or cdk path defined for resource gappbeapi, so we will use the resource logical id as the resource id
2025-03-10 09:20:34,756 | There is no customer defined id or cdk path defined for resource gappbe, so we will use the resource logical id as the resource id
2025-03-10 09:20:34,757 | 2 resources found in the stack
2025-03-10 09:20:34,757 | Found Serverless function with name='gappbe' and CodeUri='fulfillment/ful_deployment_package.zip'
2025-03-10 09:20:34,758 | --base-dir is not presented, adjusting uri fulfillment/ful_deployment_package.zip relative to /Users/mjkubba/workspace/debug/template.yaml
2025-03-10 09:20:34,758 | Skip building zip function: gappbe
2025-03-10 09:20:36,121 | Detected Inline Swagger definition
2025-03-10 09:20:36,123 | Parsing Swagger document using 3.0 specification
2025-03-10 09:20:36,123 | Found '0' authorizers in resource 'gappbeapi'
2025-03-10 09:20:36,124 | Lambda function integration not found in Swagger document at path='/sendData' method='post'
2025-03-10 09:20:36,124 | Found '0' APIs in resource 'gappbeapi'
2025-03-10 09:20:36,124 | authorizer not found or disabled, returning early
2025-03-10 09:20:36,125 | Found '1' API Events in Serverless function with name 'gappbe'
2025-03-10 09:20:36,125 | Removed duplicates from '1' Explicit APIs and '0' Implicit APIs to produce '1' APIs
2025-03-10 09:20:36,125 | 1 APIs found in the template
2025-03-10 09:20:36,129 | Mounting gappbe at http://127.0.0.1:3000/sendData [POST, OPTIONS]
2025-03-10 09:20:36,129 | You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will
be reflected instantly/automatically. If you used sam build before running local commands, you will need to re-run sam build for the changes to be picked up. You only need to restart
SAM CLI if you update your AWS SAM template
2025-03-10 09:20:36,130 | Localhost server is starting up. Multi-threading = True
2025-03-10 09:20:36,130 | Setting SIGTERM interrupt handler
2025-03-10 09:20:36 WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:3000
2025-03-10 09:20:36 Press CTRL+C to quit
2025-03-10 09:20:41,076 | UnicodeDecodeError while processing HTTP request: 'utf-8' codec can't decode byte 0xb5 in position 473: invalid start byte
2025-03-10 09:20:41,077 | Lambda execution failed ()
2025-03-10 09:20:41 127.0.0.1 - - [10/Mar/2025 09:20:41] "POST /sendData HTTP/1.1" 502 -
Expected result:
passing in the file as binary to lambda for processing
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Description:
When sending file (postman or frontend) to backend lambda through API Gateway I'm getting an error while doing local testing with sam local start-api
UnicodeDecodeError while processing HTTP request: 'utf-8' codec can't decode byte 0xb5 in position 473: invalid start byte
.While the deployed application behave normally with an actual API Gateway and Lambda
Steps to reproduce:
template:
python code example:
curl:
Observed result:
Expected result:
passing in the file as binary to lambda for processing
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.133.0The text was updated successfully, but these errors were encountered: