Lambda Boto3 “Unknown service: 'sqs'”
See original GitHub issueI’ve just written a Python Lambda function which does some MySQL stuff and then sends a message off to SQS. This all works fine locally and the message is sent to SQS successfully.
I am creating an SQS Client like so:
sqsClient = boto3.client('sqs')
However, after deploying my packaged Lambda function to AWS and running the built-in Lambda test feature. I get the following error:
{
"errorMessage": "Unknown service: 'sqs'. Valid service names are: ",
"errorType": "UnknownServiceError",
"stackTrace": [
" File \"/var/lang/lib/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n",
" File \"/var/lang/lib/python3.7/imp.py\", line 171, in load_source\n module = _load(spec)\n",
" File \"<frozen importlib._bootstrap>\", line 696, in _load\n",
" File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked\n",
" File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n",
" File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n",
" File \"/var/task/main.py\", line 20, in <module>\n sqsClient = boto3.client('sqs')\n",
" File \"/var/task/boto3/__init__.py\", line 91, in client\n return _get_default_session().client(*args, **kwargs)\n",
" File \"/var/task/boto3/session.py\", line 263, in client\n aws_session_token=aws_session_token, config=config)\n",
" File \"/var/task/botocore/session.py\", line 838, in create_client\n client_config=config, api_version=api_version)\n",
" File \"/var/task/botocore/client.py\", line 79, in create_client\n service_model = self._load_service_model(service_name, api_version)\n",
" File \"/var/task/botocore/client.py\", line 117, in _load_service_model\n api_version=api_version)\n",
" File \"/var/task/botocore/loaders.py\", line 132, in _wrapper\n data = func(self, *args, **kwargs)\n",
" File \"/var/task/botocore/loaders.py\", line 378, in load_service_model\n known_service_names=', '.join(sorted(known_services)))\n"
]
}
My initial thought was that maybe the Lambda version of boto3 doesn’t include SQS yet. I don’t think this is the issue though as I am deploying my own version of boto and botocore. I’ve also added the following lines in my function to ensure Lambda is using my deployed version of boto and and not it’s inbuilt version:
print("boto3 version:"+boto3.__version__)
print("botocore version:"+botocore.__version__)
Which is outputting the following versions:
boto3 version:1.9.87
botocore version:1.12.87
These are correct and the same as my local versions.
Any help would be appreciated. Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
botocore.session.get_session().get_available_services())
is not outputting anything on the live Lambda.Can you see what might be wrong with my deployment process?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don’t have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.