Registry / devops / graphql-playground-middleware-lambda

graphql-playground-middleware-lambda

JSON →
library1.7.24jsnpmunverified

Lambda middleware for GraphQL Playground, an interactive GraphQL IDE supporting subscriptions, docs, and collaboration. Current stable version is 1.7.24. Releases are infrequent. Key differentiator: designed specifically for AWS Lambda using API Gateway; security vulnerability existed in versions <1.7.17, fixed by sanitizing input. Ships TypeScript types. Requires aws-lambda peer dependency. Commonly used with serverless frameworks.

npm install graphql-playground-middleware-lambda
INSTALL
IMPORT
SIG · GRAPHQL-PLAYGROUND
G
graphql-playground-middleware-lambda
devopsjavascriptv1.7.24
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import lambdaPlayground from 'graphql-playground-middleware-lambda'
const lambdaPlayground = require('graphql-playground-middleware-lambda')
Package uses ESM default export; CommonJS require must use .default.
lambdaPlayground
const { default: lambdaPlayground } = require('graphql-playground-middleware-lambda')
const { lambdaPlayground } = require('graphql-playground-middleware-lambda')
Named export is not available; must destructure default.
LambdaPlaygroundOptions
import type { LambdaPlaygroundOptions } from 'graphql-playground-middleware-lambda'
import { LambdaPlaygroundOptions } from 'graphql-playground-middleware-lambda'
TypeScript type export; only available for type imports.

Shows ESM import of default export, then calling as a Lambda handler with endpoint and settings.

import lambdaPlayground from 'graphql-playground-middleware-lambda'; export const handler = lambdaPlayground({ endpoint: process.env.GRAPHQL_ENDPOINT ?? '/graphql', subscriptionEndpoint: process.env.GRAPHQL_SUBSCRIPTION_ENDPOINT ?? '/graphql', settings: { 'request.credentials': 'same-origin', }, }); // Or with CommonJS: // const { default: lambdaPlayground } = require('graphql-playground-middleware-lambda'); // exports.handler = lambdaPlayground({ // endpoint: process.env.GRAPHQL_ENDPOINT ?? '/graphql', // settings: { // 'request.credentials': 'same-origin', // }, // });
Debug
Known issues
breakingAll versions before 1.7.17 are vulnerable to arbitrary HTML injection when user input is passed to lambdaPlayground options.
fix
Upgrade to 1.7.17+; if unable, sanitize all user input passed to lambdaPlayground.
affects: <1.7.17
gotchaCommonJS require does not get the function directly; you must use .default.
fix
Use const { default: lambdaPlayground } = require('graphql-playground-middleware-lambda');
affects: >=1.0.0
deprecatedThe package is in maintenance mode; future updates are infrequent.
fix
Consider migrating to graphql-playground-html or @graphql-inspector/playground.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: lambdaPlayground is not a function
CJS require importing the default export incorrectly.
fix
Use require('graphql-playground-middleware-lambda').default
Cannot find module 'aws-lambda'
Missing peer dependency aws-lambda.
fix
Run npm install aws-lambda --save-dev or yarn add aws-lambda --dev
SecurityError: Unsanitized input in graphql-playground-middleware-lambda
Using version <1.7.17 with unsanitized user input.
fix
Upgrade to 1.7.17+ or sanitize all user input passed to lambdaPlayground.
Upgrade
Version history
1.7.24latest on npm
Audit
Dependencies
aws-lambdarequiredpeer dependency for AWS Lambda types
Agent activity
6 hits · last 30 days
node
6
Resources
graphql-playground-middleware-lambda — npm install graphql-playground-middleware-lambda · libregistry