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
asked 4 years ago485 views
3 Answers
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
answered 4 years ago
0

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

answered 4 years ago
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)

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions