question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type Error after update from next 13.0.3 to 13.0.5 with NextApiResponse

See original GitHub issue

In the latest version of next (13.0.5) they removed the unstable_revalidate function from the NextApiResponse interface.

I became so now a compile error if I use the preview mode of next-drupal, because it has next in version 12 as dependency. The following code create this error, I think that drupal.preview check this type with the dependency.

import { drupal } from 'lib/drupal';
import type { NextApiRequest, NextApiResponse } from 'next';

export default async function handler(
  request: NextApiRequest,
  response: NextApiResponse
) {
  return drupal.preview(request, response);
}
Argument of type 'import("node_modules/next/dist/shared/lib/utils").NextApiResponse<any>' is not assignable to parameter of type 'import("node_modules/next-drupal/node_modules/next/dist/shared/lib/utils").NextApiResponse<any>'.
  Property 'unstable_revalidate' is missing in type 'ServerResponse<IncomingMessage> & { send: Send<any>; json: Send<any>; status: (statusCode: number) => NextApiResponse<any>; redirect(url: string): NextApiResponse<...>; redirect(status: number, url: string): NextApiResponse<...>; setPreviewData: (data: string | object, options?: { ...; }) => NextApiResponse<...>; cl...' but required in type '{ send: Send<any>; json: Send<any>; status: (statusCode: number) => NextApiResponse<any>; redirect(url: string): NextApiResponse<any>; redirect(status: number, url: string): NextApiResponse<...>; setPreviewData: (data: string | object, options?: { ...; }) => NextApiResponse<...>; clearPreviewData: (options?: { ...; ...'.ts(2345)
utils.d.ts(225, 5): 'unstable_revalidate' is declared here.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
shadcncommented, Nov 28, 2022

I’m working on adding support for Next.js 13 this week. I’ll update here when done. Thank you.

0reactions
shadcncommented, Dec 6, 2022

@martdavidson Thanks for your helping testing this. I’ve merged the PR. This will be in the 1.6.0 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Next.js 13 `app` directory · Issue #5647 - GitHub
The only thing left is to get the request/response object to get the session on the layout server component and pass it to...
Read more >
Upgrade Guide - Next.js
Upgrade Guide. Upgrading from 12 to 13. To update to Next.js version 13, run the following command using your preferred package manager:
Read more >
Handling API errors in Next.js - By Giancarlo Buomprisco
Learn how to write a Next.js middleware pipe to automatically and elegantly handle exceptions in your API functions.
Read more >
resolver is not a function nextjs - You.com | The AI Search ...
I am attempting to create a basic post on click in my NextJS app to a MongoDB database. The issue i am getting...
Read more >
next@10.0.5 - Snyk Vulnerability Database
Learn more about known next 10.0.5 vulnerabilities and licenses detected. ... Specially encoded paths could be used when pages/_error.js was statically ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found