gpt4 book ai didi

amazon-web-services - Amazon Lambda Java SDK,与服务名称不一致

转载 作者:太空宇宙 更新时间:2023-11-04 13:17:01 25 4
gpt4 key购买 nike

我正在尝试通过 AWS Java SDK 调用 AWS Lambda 代码,但它产生了一个奇怪的错误,我只是在 google 上发现了该错误,该错误据说不久前已修复。

The service name : "BackplaneExecutionService" identified from the payload does not agree with the service name : "AWSLambda" specified in the transport header (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: c40b5e2e-807b-11e5-88d6-6f0496ed99c7)com.amazonaws.AmazonServiceException: The service name : "BackplaneExecutionService" identified from the payload does not agree with the service name : "AWSLambda" specified in the transport header (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: c40b5e2e-807b-11e5-88d6-6f0496ed99c7)    at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:710)    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:385)    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:196)    at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:387)    at com.amazonaws.services.lambda.AWSLambdaClient.invoke(AWSLambdaClient.java:322)    at .....

My code to invoke this looks like:

    BasicAWSCredentials androidClientCredentials = new BasicAWSCredentials(
"cccccccc",
"ccc+cc/cc"
);
AWSLambdaClient lambdaClient = new AWSLambdaClient(androidClientCredentials);
lambdaClient.setRegion(Region.getRegion(Regions.US_EAST_1));
lambdaClient.setEndpoint("https://cc.execute-api.us-east-1.amazonaws.com/prod/asdf");
lambdaClient.setServiceNameIntern("execute-api");
InvokeRequest request = new InvokeRequest();
request.setInvocationType(InvocationType.RequestResponse);
request.setFunctionName("arn:aws:lambda:us-east-1:1234:asdf:$LATEST");
Map<String,String> payload = new HashMap<>(4);
payload.put("username",U);
payload.put("password", P);
request.setPayload(ByteBuffer.wrap(new JSONObject(payload).toString().getBytes()));
InvokeResult result = lambdaClient.invoke(request);

有什么想法或方向吗?

最佳答案

感谢@jarmod,此错误是由于我对如何使 Lambda 函数可访问感到困惑。从 UI 看来,我需要创建一个“API 端点”。在阅读了有关通过 AWS 创建 API 的更多信息后,这似乎是一个用于创建自定义端点 URL 的特殊功能(我还没有完全理解该功能)。

我了解到您不需要“API 端点”,并且我能够删除 setEndpointsetServiceNameInter 方法调用

关于amazon-web-services - Amazon Lambda Java SDK,与服务名称不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33460953/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com