Skip to main content

Install

pnpm add aws-appsync-js
# or
npm install aws-appsync-js
# or
yarn add aws-appsync-js
# or
bun add aws-appsync-js

That's it for the core. No transitive dependencies are installed.

Optional peer dependencies​

You only need these if you want full TypedDocumentNode inference (recommended):

pnpm add -D graphql @graphql-typed-document-node/core

…and a codegen toolchain to produce the typed documents:

pnpm add -D @graphql-codegen/cli @graphql-codegen/typescript \
@graphql-codegen/typescript-operations \
@graphql-codegen/typed-document-node

See TypeScript & codegen for the codegen.ts config.

Supported runtimes​

RuntimeStatus
Node 18.17 LTSβœ…
Node 20 / 22 LTSβœ…
Cloudflare Workersβœ… (apiKey / Cognito / OIDC / Lambda β€” see Edge runtimes)
Vercel Edgeβœ… (same caveat as Workers)
Deno β‰₯ 1.40βœ… via the npm: specifier
Bun β‰₯ 1.0βœ…
Chrome / Edge / Firefox (latest two)βœ…
Safari 16+βœ…

The only hard requirement is a working global fetch (Node β‰₯ 18 has one). You can inject a custom fetch via new AppSyncClient({ fetch }) if you need to.

Module formats​

The package ships both ESM and CJS with proper .d.ts for each, validated in CI by publint and @arethetypeswrong/cli:

"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
}

ESM-first, sideEffects: false, fully tree-shakable.

Verifying the install​

import { AppSyncClient, AUTH_MODE } from 'aws-appsync-js';

console.log(Object.values(AUTH_MODE));
// β†’ [ 'API_KEY', 'AWS_IAM', 'AMAZON_COGNITO_USER_POOLS', 'OPENID_CONNECT', 'AWS_LAMBDA' ]