小编JWB*_*JWB的帖子

如何正确调用AWS Lambda + API Gateway的queryStringParameters?

我正在遵循有关使用 Lambda 函数设置 AWS API Gateway 以创建 Restful API 的教程。我有以下代码:

import json

def lambda_handler(event, context):
    # 1. Parse query string parameters
    transactionId = event['queryStringParameters']['transactionid']
    transactionType = event['queryStringParameters']['type']
    transactionAmounts = event['queryStringParameters']['amount']

    # 2. Construct the body of the response object
    transactionResponse = {}
    # returning values originally passed in then add separate field at the bottom
    transactionResponse['transactionid'] = transactionId
    transactionResponse['type'] = transactionType
    transactionResponse['amount'] = transactionAmounts
    transactionResponse['message'] = 'hello from lambda land'

    # 3. Construct http response object
    responseObject = {}
    responseObject['StatusCode'] …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services python-3.x aws-lambda aws-api-gateway

7
推荐指数
1
解决办法
3万
查看次数

错误:(gcloud.app.deploy) 错误响应:[13] 在 Google App Engine 中部署 Flex 环境

我正在尝试让 GDAL 在 Google App Engine 中工作。我一直在关注这个帖子。我有一个类似的 app.yaml 和 Dockerfile,以及我的脚本和requirements.txt,作为我的部署文件夹的一部分。运行后出现以下错误

gcloud app deploy
Run Code Online (Sandbox Code Playgroud)
Updating service [default] (this may take several minutes)...failed.
                                                                                                                                                                                                                 
ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects
/flex-env-gdal-api/regions/us-central1/operations/230ef197-33ab-43ee-bbac-85b53e6c8fd0 

error [INTERNAL]: An internal error occurred while processing task 
/appengine-flex-v1/insert_flex_deployment/flex_create_resources>
2020-07-20T19:50:34.913Z71509.jo.14: Deployment Manager operation 
flex-env-gdal-api/operation-1595274635522-5aae4d1f830ec-81a3f5de-b5b771bf 

errors: [code: "RESOURCE_ERROR" location: "/deployments/aef-default 20200720t144747/resources/aef-default-20200720t144747" 
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"message\":\"The caller does not have permission\",\"status\":\"PERMISSION_DENIED\",\"statusMessage\":\"Forbidden\",
\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/flex-env-gdal-api/regions/us-central1/autoscalers\",
\"httpMethod\":\"POST\"}}"
]
Run Code Online (Sandbox Code Playgroud)

环顾四周后,错误响应 [13] 似乎与权限相关。我在 IAM 中拥有所有者角色,所以我不确定这就是问题所在。如果有人有任何可以尝试的建议,我将不胜感激。

python google-app-engine gdal google-cloud-platform gcloud

2
推荐指数
1
解决办法
6234
查看次数