EvaluateCode
Source:
src/AWS/AppSync/EvaluateCode.ts
Runtime binding for appsync:EvaluateCode — evaluate APPSYNC_JS
resolver/function code against a mock context without touching a deployed
resolver. Useful for CI/tooling functions that validate resolver code
before it ships.
An account-level operation: the binding takes no resource. GraphQL
evaluation errors do not fail the effect — they surface on the
response’s error field. Provide AppSync.EvaluateCodeHttp on the
hosting function’s Effect to implement the binding.
Evaluating Resolver Code
Section titled “Evaluating Resolver Code”// init — account-level binding takes no resourceconst evaluateCode = yield* AppSync.EvaluateCode();
// runtimeconst result = yield* evaluateCode({ runtime: AppSync.APPSYNC_JS, code: ` export function request(ctx) { return { payload: ctx.args.a + ctx.args.b }; } export function response(ctx) { return ctx.result; } `, context: JSON.stringify({ arguments: { a: 2, b: 3 } }), function: "request",});// JSON.parse(result.evaluationResult!) → { payload: 5 }