
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
zephyr-nextjs-adapter
Advanced tools
Next.js Deployment Adapter for Zephyr Cloud - using the official Next.js Adapter API
A Next.js deployment adapter that integrates with the Zephyr Cloud platform using the official Next.js Adapter API. This adapter replaces the webpack plugin approach with a cleaner, more reliable solution that waits for the complete build to finish before creating a single snapshot.
The Zephyr Next.js Adapter provides:
// next.config.js (OLD)
const { withZephyr } = require('zephyr-nextjs-plugin');
module.exports = withZephyr(
{
// Next.js config
},
{
// Zephyr plugin config
orgId: process.env.ZEPHYR_ORG_ID,
projectId: process.env.ZEPHYR_PROJECT_ID,
}
);
// next.config.js (NEW)
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
adapterPath: 'zephyr-nextjs-adapter',
},
};
module.exports = nextConfig;
npm install zephyr-nextjs-adapter
# or
yarn add zephyr-nextjs-adapter
# or
pnpm add zephyr-nextjs-adapter
Update your next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
adapterPath: 'zephyr-nextjs-adapter',
},
// Your existing Next.js configuration
reactStrictMode: true,
// ...
};
module.exports = nextConfig;
The adapter automatically discovers your organization and project from git, so you only need authentication:
Option A: Environment Variable
export ZEPHYR_API_KEY=your-api-key
Option B: Zephyr CLI Login (Recommended)
npx zephyr login
# This stores your authentication token automatically
Optional Configuration:
# Optional - auto-detected from NODE_ENV
ZEPHYR_ENVIRONMENT=development|staging|production
# Optional - defaults to false
ZEPHYR_MODULE_FEDERATION=true|false
The adapter will automatically detect:
npm run build
The adapter will:
Create a custom adapter file for advanced use cases:
// zephyr.adapter.mjs
import { createZephyrAdapter } from 'zephyr-nextjs-adapter';
export default createZephyrAdapter({
// Custom configuration options
uploadBatchSize: 50,
enableDetailedLogging: true,
customAssetFilter: (asset) => {
// Filter assets before upload
return !asset.pathname.includes('/_error');
},
customMetadata: {
deploymentVersion: '1.2.3',
buildHash: process.env.BUILD_HASH,
},
});
Then reference it in your next.config.js:
module.exports = {
experimental: {
adapterPath: './zephyr.adapter.mjs',
},
};
// zephyr.adapter.mjs
import { createZephyrAdapter } from 'zephyr-nextjs-adapter';
export default createZephyrAdapter({
onBuildComplete: async (ctx) => {
const isDevelopment = process.env.NODE_ENV === 'development';
if (isDevelopment) {
console.log('Development mode - skipping upload');
return;
}
// Production upload logic
await uploadToZephyr(ctx);
},
});
The adapter integrates seamlessly with your existing Zephyr infrastructure:
// Example integration with ZephyrEngine
import { ZephyrEngine } from 'zephyr-agent';
import { createZephyrAdapter } from 'zephyr-nextjs-adapter';
export default createZephyrAdapter({
onBuildComplete: async (ctx) => {
const zephyrEngine = new ZephyrEngine({
orgId: process.env.ZEPHYR_ORG_ID,
projectId: process.env.ZEPHYR_PROJECT_ID,
apiKey: process.env.ZEPHYR_API_KEY,
});
// Convert Next.js outputs to Zephyr format
const assetsMap = convertToZephyrFormat(ctx.outputs);
// Use existing upload infrastructure
await zephyrEngine.upload_assets({
assetsMap,
buildStats: generateBuildStats(ctx),
});
},
});
The adapter captures and processes all Next.js build outputs:
/_next/static/css/)/_next/static/chunks/)| Feature | Webpack Plugin | Next.js Adapter |
|---|---|---|
| Upload Timing | During compilation | After complete build |
| Integration | Webpack hooks | Official Next.js API |
| Reliability | Fragile webpack internals | Stable Next.js interface |
| Build Capture | Partial (compilation-time) | Complete (final state) |
| Configuration | Complex webpack setup | Simple Next.js config |
| Maintenance | High (webpack changes) | Low (stable API) |
"adapterPath not recognized"
Environment variables not set
ZEPHYR_ORG_ID, ZEPHYR_PROJECT_ID, and ZEPHYR_API_KEY are setUpload failures
Enable detailed logging:
DEBUG=zephyr:* npm run build
Or set the environment variable:
ZEPHYR_DEBUG=true npm run build
The adapter creates a manifest file for debugging:
# Check the generated manifest
cat .next/zephyr-snapshot-manifest.json
interface ZephyrAdapterConfig {
// Upload configuration
uploadBatchSize?: number;
uploadTimeout?: number;
// Filtering options
customAssetFilter?: (asset: AdapterOutput) => boolean;
excludePatterns?: string[];
// Metadata customization
customMetadata?: Record<string, any>;
// Logging options
enableDetailedLogging?: boolean;
logLevel?: 'error' | 'warn' | 'info' | 'debug';
// Custom hooks
onBuildStart?: () => Promise<void> | void;
onBuildComplete?: (ctx: BuildContext) => Promise<void> | void;
onUploadStart?: (snapshot: Snapshot) => Promise<void> | void;
onUploadComplete?: (result: UploadResult) => Promise<void> | void;
}
interface BuildContext {
routes: {
headers: Array<HeaderRoute>;
redirects: Array<RedirectRoute>;
rewrites: RewriteRoutes;
dynamicRoutes: Array<DynamicRoute>;
};
outputs: Array<{
id: string;
pathname: string;
filePath: string;
type: RouteType;
runtime?: 'nodejs' | 'edge';
config?: FunctionConfig;
assets?: Record<string, string>;
fallbackID?: string;
}>;
}
MIT - see LICENSE file for details.
FAQs
Next.js Deployment Adapter for Zephyr Cloud - using the official Next.js Adapter API
We found that zephyr-nextjs-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.