这个问题可能是因为API Gateway配置不正确所致,解决方法如下:
以下是示例代码:
import boto3
client = boto3.client('apigateway')
response = client.update_method(
restApiId='XXXXXXXXXX', # Replace with your API Gateway ID
resourceId='YYYYYYYYYY', # Replace with your API Gateway Resource ID
httpMethod='GET', # Replace with your Request Method
patchOperations=[
{
'op': 'replace',
'path': '/authorizationType',
'value': 'NONE'
}
]
)
response = client.update_method(
restApiId='XXXXXXXXXX',
resourceId='YYYYYYYYYY',
httpMethod='GET',
patchOperations=[
{
'op': 'replace',
'path': '/authorizerId',
'value': None
}
]
)
response = client.create_deployment(
restApiId='XXXXXXXXXX', # Replace with your API Gateway ID
stageName='prod' #Replace with your API Gateway Stage Name
)
print(response)