Conversation
- Update TypeScript configuration to support `react-jsx`. - Add `"use client"` directive to React pages for client-side rendering. - Update dependencies in `package-lock.json`, including `ably`, `eslint`, and `next.js` versions. - Refactor Next.js configuration: replace `domains` with `remotePatterns` for image handling and adjust server package settings. -Updated token generation to use the preferred JWT method.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the project to newer Next.js/TypeScript tooling and adjusts client/server behavior for the Ably examples, including a refactor of the /token route to generate JWTs.
Changes:
- Update TypeScript JSX mode to
react-jsxand tweaktsconfigincludes. - Upgrade key dependencies (Next.js, ESLint, Ably) and add
jsonwebtoken(+ typings). - Update Next.js configuration for images (
remotePatterns) and server package externals; mark several App Router pages as client components.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch JSX mode to react-jsx and adjust include paths. |
| package.json | Upgrade Next.js/ESLint/Ably and add JWT dependencies for token signing. |
| next.config.js | Replace images.domains with images.remotePatterns and update server externals config. |
| app/token/route.ts | Replace Ably SDK token request generation with JWT signing logic. |
| app/pub-sub/page.tsx | Add 'use client' directive for client-side rendering needs. |
| app/presence/page.tsx | Add 'use client' directive for client-side rendering needs. |
| app/history/page.tsx | Add 'use client' directive for client-side rendering needs. |
| app/authentication/page.tsx | Add 'use client' directive for client-side rendering needs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import * as Ably from "ably"; | ||
| import jwt from 'jsonwebtoken'; | ||
|
|
||
| export async function POST(req: Request) { |
There was a problem hiding this comment.
NextRequest is imported but never used in this route handler. This will trigger no-unused-vars under next/core-web-vitals; remove it from the import or change the handler signature to use NextRequest if needed.
| export async function POST(req: Request) { | |
| export async function POST(req: NextRequest) { |
| const apiKey = process.env.ABLY_API_KEY; | ||
| const [keyName, keySecret] = apiKey.split(':'); | ||
|
|
There was a problem hiding this comment.
apiKey is typed as string | undefined (because process.env.* values are optional), so apiKey.split(':') will fail TypeScript strict type-checking. Capture the env var into a local const apiKey = process.env.ABLY_API_KEY and validate apiKey (or use a non-null assertion after validation) before calling .split().
| "jsonwebtoken": "^9.0.3", | ||
| "next": "^16.1.6", | ||
| "random-names-generator": "^1.0.2", |
There was a problem hiding this comment.
next@16.1.6 declares engines.node >= 20.9.0 (per the resolved package metadata in package-lock.json). Consider adding a matching "engines" entry (and/or documenting it) so deploy/runtime environments don’t accidentally use an unsupported Node version.
…yment documentation - Introduce wrapper components (`*Wrapper`) to simplify dynamic imports for client-side rendering. - Update README to include Netlify deployment instructions alongside Vercel. - Add `netlify.toml` for Netlify deployment support. - Install `@netlify/plugin-nextjs` as a dev dependency for Netlify compatibility.
79d979b to
1070656
Compare
This PR overhauls the current NextJs version and Ably versions, corrects token usage to the recommended way (via JWT) and adds Netlify deployment support.
Other minor changes include:
react-jsx."use client"directive to React pages for client-side rendering.package-lock.json, includingably,eslint, andnext.jsversions.domainswithremotePatternsfor image handling and adjust server package settings.-Updated token generation to use the preferred JWT method.