Documentation should specify that the endpoint argument of client object has to be set manually to https://{api-id}.execute-api.{region}.amazonaws.com/{stage}, or otherwise the post_to_connection function will timeout and do nothing, or cause an internal error.
Example:
# from
client = boto3.client('apigatewaymanagementapi')
# to
client = boto3.client('apigatewaymanagementapi', endpoint_url='https://{api-id}.execute-api.{region}.amazonaws.com/{stage}')
This will save a lot of time and nerve for people developing API gateway web socket integrations
id just like to bump this as it caused me a lot of issues since the documentation is so unclear.
As I can see the documentation hasn't been updated yet. Any reason why?
This caused me 2 days of pain. Would be a great idea if we can update this in the docs
THIS IS NEEDED IN THE DOCS!
Grrhh! THis has just caused me a lot of pain.. Please Pelase update the docs!
This still to this date is creating confusion on documentation and led me to this thread
Now the documentation is updated with the correct information on how to use endpoint.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/apigatewaymanagementapi.html
To use it, you must explicitly set the SDK's endpoint to point to the endpoint of your deployed API. The endpoint will be of the form https://{api-id}.execute-api.{region}.amazonaws.com/{stage}, or will be the endpoint corresponding to your API's custom domain and base path, if applicable.
Let us know if anyone has still any questions.
@swetashre I think that including the endpoint_url optional parameter to the client constructor in the documentation might be more easily skimmable and more clear given it seems like it's necessary for a good number of people from the likes and very vibrant comments.
client = boto3.client('apigatewaymanagementapi', endpoint_url='https://{api-id}.execute-api.{region}.amazonaws.com/{stage}')
Agreed with @dixler, if it is a must it should be written in the client initiation code. Thanks for making it clear of what is confusing us! Just like the methods that each has a "Parameters" section, the client could have one also, stating which parameters are possible.
Most helpful comment
id just like to bump this as it caused me a lot of issues since the documentation is so unclear.