Skip to content

oidc does not exist on Request type #5897

Discussion options

You must be logged in to vote

@CalebJamesStevens, like @dtsuper3 said, you can't mix an express and nextjs.

If you want to have oidc in the req object, you will need to modify the GetServerSidePropsContext type.
Try doing this:

  • add a new next.d.ts file in your project and add the following code in it.
  • aim here is to add a new oidc property in it.
import type { GetServerSidePropsContext as OriginalGetServerSidePropsContext } from "next/types";

declare module "next" {
	export type GetServerSidePropsContext<
		Q extends ParsedUrlQuery = ParsedUrlQuery,
		D extends PreviewData = PreviewData,
	> = OriginalGetServerSidePropsContext<Q, D> & {
		req: {
			oidc: string; // use the correct type here
		};
	};

	export type Ge…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by IamLizu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #5170 on September 02, 2024 16:58.