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β
| Runtime | Status |
|---|---|
| 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' ]