InternalFailure error from Pipeline Resolver

1

Scenario:
I've created a basic Amplify project and am adding additional configuration (specifically a Pipeline Resolver) via CloudFormation. After pushing, everything looks okay and I can view the resolver in the console.
However, on executing a query, which invokes the resolver, I am getting an error of type "InternalFailure" and message "An internal failure occurred while resolving this field."

Schema
type Employee @model {
id: ID!
legacyId: Int
firstName: String
lastName: String
role: String
}

type Query {
getEmployeeV2(id: ID!): Employee
}

Query
query GetEmployee {
getEmployeeV2(id: 123) {
id
firstName,
lastName
}
}

The vtls contain the default settings for DynamoDB datasource.

The logs show nothing but ExecutionSummary, RequestSummary and Req/Resp Headers - nothing pertinent to this issue (as far as I can see).

Has anyone seen this sort of issue?
Thanks

joebri
질문됨 4년 전495회 조회
3개 답변
1

I've determined the cause of the error. The Pipeline Resolver 'Before mapping template' and 'After mapping template' were empty! They were being created from over-ride files in the project which were set as empty files (or rather, just comments).

The fix, of course, if to set the 'before template' to {} and the 'After template' to $util.toJson($ctx.result)

joebri
답변함 4년 전
0

Can you provide graphQlApiId and timestamp so that we can do further investigation?

답변함 4년 전
0

Hello I am facing the same error even though I have set {} in Before Mapping Template.

Before Mapping Template:

{}

Function Request Mapping Template:

#set( $attribs = $util.dynamodb.toMapValues($context.args.input) )
{
"operation" : "PutItem",
"key" : {
## If object "id" should come from GraphQL arguments, change to $util.dynamodb.toDynamoDBJson($ctx.args.id)
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
},
"attributeValues" : $util.dynamodb.toMapValuesJson($attribs)
}

Function Response Mapping Template:

#if($ctx.error)
$util.error($ctx.error.message, $ctx.error.type)
#end

Pass back the result from DynamoDB. **

$util.toJson($ctx.result)

After Mapping Template:

$util.toJson($ctx)

답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠