alpha

Gives rules for building AWS AppSync Event API handlers in the APPSYNC_JS runtime, covering data source setup, IAM least privilege, onPublish and onSubscribe contracts, and linting.
description: 'Production-grade guidance for AWS AppSync Event API handlers using APPSYNC_JS runtime restrictions, utilities, modules, and datasource patterns'
applyTo: '**/*.{graphql,gql,vtl,ts,js,mjs,cjs,json,yml,yaml}'
Use these instructions when implementing AWS AppSync Event API handlers (onPublish, onSubscribe) with the APPSYNC_JS runtime.
onPublish runs before broadcast, onSubscribe runs on subscription attempts.Use data sources intentionally based on event workflow needs:
Prefer combining multiple data sources only when each hop has a clear reason (auth, persistence, enrichment, routing).
appsync.amazonaws.com to assume the role.aws:SourceAccount to your account.aws:SourceArn to a specific AppSync API ARN (or tightly scoped pattern).The APPSYNC_JS runtime is a constrained JavaScript subset. Write code for this environment, not for full Node.js.
async/await, or background async workflows.try/catch/finally, throw, while, C-style for(;;), continue, labels, unsupported unary operators.for-of / for-in loops when iteration is needed.ctx.events directly.request(ctx) and response(ctx).runtime.earlyReturn(...) when business logic decides to skip data source invocation and response mapping.ctx.info.channel.path, ctx.info.channel.segments, ctx.info.channelNamespace.name, and ctx.info.operation to drive routing logic.onPublish with data source integration, return the event list to broadcast from response(ctx).onSubscribe with data source integration, include a response(ctx) function (it can be empty when no follow-up mapping is needed).ctx.prev.result vs ctx.stash (Pipeline Guidance)ctx.prev.result.ctx.prev.result as the default data handoff mechanism between consecutive pipeline functions.ctx.stash when you need shared data across multiple pipeline stages that is not just the immediate previous result.ctx.stash (for example flags, IDs, correlation context), not large payload copies.ctx.stash when ctx.prev.result already provides the needed value.throw in handlers. Use util.error(...) and util.appendError(...) patterns supported by AppSync runtime.Use util for runtime-safe helpers.
util.urlEncode, util.urlDecodeutil.base64Encode, util.base64Decoderuntime.earlyReturn(obj) to stop current handler execution and skip data source + response evaluation.Use official modules from @aws-appsync/utils and keep code declarative.
import * as ddb from '@aws-appsync/utils/dynamodb'import { ... } from '@aws-appsync/utils/rds'Prefer module helpers over handwritten request objects where possible.
get, put, remove, update, query, scan, sync.batchGet, batchPut, batchDelete.transactGet, transactWrite.update, prefer operation helpers like increment/append/add/remove for safe patch-style mutations.scan unless justified.batchPut/batchDelete (or transactWrite when atomicity is required) over many single-item operations.For Event API Lambda data source requests, use:
operation: 'Invoke'invocationType: 'RequestResponse' | 'Event'payload shaped explicitly for the Lambda contractGuidance:
RequestResponse when handler flow depends on Lambda output.Event only for fire-and-forget side effects.ctx.result in response(ctx) and map to the exact outgoing event shape.Invoke; do not rely on GraphQL-style BatchInvoke here.Invoke and implement item-level aggregation/partial-failure handling inside Lambda.You can configure namespace handlers with direct Lambda integrations (Behavior: DIRECT) instead of writing onPublish/onSubscribe code.
REQUEST_RESPONSE mode:onPublish Lambda returns { events?: OutgoingEvent[], error?: string }.onSubscribe Lambda returns null for success or { error: string } for rejection.EVENT mode:error in request/response mode, it is logged when logging is enabled, and not sent back as a detailed internal error payload.Prefer direct Lambda integration when the entire namespace behavior can be centralized in Lambda and you do not need APPSYNC_JS request/response mapping logic.
When using non-DynamoDB data sources:
resourcePath, method, optional params (headers, query, body); check ctx.result.statusCode, ctx.result.body, and ctx.error.operation: 'PutEvents' and build deterministic event entries from ctx.events.createPgStatement/createMySQLStatement; do not interpolate unsafe SQL.ctx.result.operation (InvokeModel or Converse) explicitly and include prompt-injection safeguards.batchGet, batchPut, batchDelete for non-atomic bulk operations.transactGet, transactWrite when atomic all-or-nothing behavior is required.operation: 'Invoke' with optional invocationType.BatchInvoke operation in handler request objects.ctx.identity, headers, and payload fields as untrusted input.@aws-appsync/eslint-plugin (plugin:@aws-appsync/base at minimum).plugin:@aws-appsync/recommended when TypeScript tooling is configured.@aws-appsync/utils imports and source maps for debugging.throw, no async/promise usage, no unsupported loop/control constructs.onPublish and onSubscribe behavior is explicit and tested.@aws-appsync/eslint-plugin is enabled.© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Defines a JSON style system where a grayscale photographic subject yields to white paper, continued by a hand-traced contour, small lowercase labels and gray image fragments.
image-prompt, json-prompt, placeholders, long-form, advanced, editorial, minimalist, black-and-white, negative-space, line-art, poster, text-rendering, portrait, film-grain, structured-output, for-artists, for-designers, surreal, before-and-after

Answers natural-language questions about AWS resources by running only read-only AWS CLI commands and showing the results as tables.
agent-skill, aws, cloud, command-line, guardrails, tool-use, troubleshooting, for-devops-engineers, for-developers, table, sysadmin, devops, security-review, cloud-security, long-form, advanced, audit, conditional-logic, bash, best-practices

Turns the AI into a financial specialist who sizes an emergency fund, designs tiered accounts, builds a savings timeline and sets usage and replenishment rules.
system-prompt, act-as, planner, expert-advice, personal-finance, financial-planning, budgeting, frugal-living, risk-management, for-families, xml-tags, structured-output, guardrails, table, timeline, step-by-step-guide, calculator, beginner-friendly, plain-language, long-form
Loading reviews…
Loading comments…