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
gefragt vor 4 Jahren495 Aufrufe
3 Antworten
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
beantwortet vor 4 Jahren
0

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

beantwortet vor 4 Jahren
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)

beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen