I ran into a very weird problem today. Although, I tried to understand what is going on I can’t get my head around what actually is happening.
I have a custom lambda resolver which runs complicated but manageable queries and mutations. Both, queries and mutations are set dynamically according to the input parameter of the resolver
// minimal example
export const removeContent = async ({ args, authHeader }) => {
try {
let query = "";
let mutations = [];
if (args.input.one) {
query = "Some quite complicated query string (working)";
mutations = { "some": "JSON" }
}
if (args.input.two) {
query = "Some quite complicated query string (working)";
mutations = { "some": "JSON" }
}
// ... more
// perform DQL upsert mutation
// ...
} catch (e) {
return {
error: JSON.stringify(e)
}
}
}
If I then perform a GraphQL mutation removeContent
I get the error
"message": "Evaluation of custom field failed because external request returned an error: Post \"http://router.fission.svc.cluster.local:80/cluster/0x73f3cf95/1/graphql-worker\": context deadline exceeded (Client.Timeout exceeded while awaiting headers) for field: removeContent within type: Mutation.",
However, I realised that if I remove some of the if
statements it is working again. Also if I change the variable declaration from let
to var
, it seems to accept more of the if
statements. Could this be a memory issue?
Thanks! Any help appreciated!