Error: The identifier 'pageProps' has already been declared

Issue Encountered:

Error Type: Duplicate identifier 'pageProps'.

Solution Attempted in _app.tsx

import { SessionProvider } from "next-auth/react"
import "tailwindcss/tailwind.css";
import '../styles/globals.css';



export default function App({Component}: {Component:any} , pageProps: { session: any,  ...pageProps: any[]}) {
}) {
  return (
    // `session` parameters sourced from `getServerSideProps` or `getInitialProps`.
    // Prevents flickering/session loading upon initial load.
    <SessionProvider session={session}>
      <Component {...pageProps} />
    </SessionProvider>
  )
} 

Adjustments Made in global.d.ts

// global.d.ts
import { MongoClient } from "mongodb"
import { PrismaClient } from '@prisma/client';
// various global declarations included. 
declare global {
    var mongoClientPromise: Promise<MongoClient>;
    var prisma: PrismaClient;
}

Updates Implemented in types.d.ts

import type { DefaultUser } from 'next-auth';

declare module 'next-auth' {
  interface Session {
    user?: DefaultUser & {
      id: string;
    };
  }
}

Maintenance Carried out in next-env.d.ts

/// <reference types="next" />
/// <reference types="next/image-types/global" />

// Important note: Avoid editing this file directly
// Check https://nextjs.org/docs/basic-features/typescript for more details.

In Search of a Resolution

Reviewing My pkg.json

{
  "name": "basically-email",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@mui/material": "^5.4.2",
    "@next-auth/mongodb-adapter": "^1.0.1",
    "@next-auth/prisma-adapter": "^1.0.1",
    "@prisma/client": "^3.9.2",
    "@types/next-auth": "^3.15.0",
    "axios": "^0.26.0",
    "mongodb": "^4.4.0",
    "next": "12.1.0",
    "next-auth": "^4.2.1",
    "react": "^17.0.2",
    "react-dom": "17.0.2",
    "typings": "^2.1.1"
  },
  "devDependencies": {
    "@types/node": "^17.0.18",
    "@types/react": "17.0.39",
    "autoprefixer": "^10.4.2",
    "eslint": "8.9.0",
    "eslint-config-next": "12.1.0",
    "postcss": "^8.4.6",
    "prisma": "^3.9.2",
    "tailwindcss": "^3.0.23",
    "typescript": "^4.5.5"
  }
}

Puzzled by the Persisting Issue

Vercel Deployment and Error Encounter

If you have insights on rectifying this error, kindly share your suggestions. Thank you! The error emerged during the app deployment on Vercel, resulting in build failure. Upon running the project on localhost:3000, it functions smoothly without any errors. I am puzzled by why this error appeared specifically during Vercel deployment.

Answer №1

Wow, having two instances of pageProps seems quite confusing. This type of question is not suitable for Stack Overflow as it shows minimal effort.

https://i.sstatic.net/28iGn.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transforming a flat TypeScript array into a nested object structure

I'm working on implementing a user interface to offer a comprehensive overview of our LDAP branches. To achieve this, I plan to utilize Angular Materials Tree as it provides a smooth and intuitive browsing experience through all the branches (https:// ...

Guide on linking a trust policy to an IAM role through CDK

{ "Version": "2008-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "AWS": [ ...

I am struggling to comprehend the concept of dependency injection. Is there anyone available to provide a clear explanation for me?

I am working on a NestJS application and trying to integrate a task scheduler. One of the tasks involves updating data in the database using a UserService as shown below: import { Injectable, Inject, UnprocessableEntityException, HttpStatus, } fro ...

Tips for executing DOM manipulation within Angular components

What is the best way to access DOM elements in Angular (Version 2.x and above)? Since basic functions such as addClass and removeClass are not available in typescript, how can we perform DOM manipulations in Angular components? Any suggestions would be g ...

Issues arise with the play method in Storybook and Jest when attempting to use the shouldHaveBeenCalled assertion on a

Here is a snippet of the component code: import { FC, ReactElement, useState, MouseEvent as ReactMouseEvent, ChangeEvent as ReactChangeEvent, } from 'react'; import { Stack, TablePagination } from '@mui/material'; export con ...

Creating a personalized state object containing unresolved promises in React Native utilizing axios inside a custom React Hook

I'm currently in the process of creating a custom state within a custom Hook for React Native (non-Expo environment). The state I am working on looks like this: interface ResponseState { api1: { error: boolean; errorMsg?: string; ...

Node module for Nativescript angular project that enables multi select dropdown or picker functionality

Does anyone know of a Node NPM module for creating a multi-select dropdown in NativeScript Angular? I've searched through many plugins in the NativeScript marketplace, but haven't been able to find one that fits my needs. I need the plugin to wo ...

An issue with event listeners in Vue 3 and Pixi.js arises when working with DisplayObjects that are either created as properties of classes or inherited from parent classes

Utilizing PIXI js in conjunction with Vue 3 (see code snippet below) Due to the consistent pattern of most graphics with varying behaviors and properties, we opted for an OOP approach with TypeScript to prevent code duplication. However, following this app ...

Identifying row expansion in ngx-datatable: detecting expand status on row click

Is there a way to determine if a line has already been expanded when using the toggle feature? When you click on a line, it expands and shows the details. Here is some code in HTML: <ngx-datatable #dataTable ... (select)='onRowSelect($eve ...

Tips for transferring data from a service to a method within a component

I have a service that successfully shares data between 2 components. However, I now need to trigger a method in component A when an event occurs on the service (and pass a value to that component). Can someone guide me on how to achieve this? I have seen ...

Is there a way for me to directly download the PDF from the API using Angular?

I'm trying to download a PDF from an API using Angular. Here's the service I've created to make the API call: getPDF(id:any) { return this.http.get( `url?=${id}`, { responseType: 'blob' as 'json', obs ...

Understanding how types intersect in TypeScript

I'm currently diving into Type Relations in TypeScript. Can someone help explain what happens when we intersect the types represented by these two expressions: {a:number}[] & {b:string}[] Does this result in {a:number, b:string}[] ? Any clarificat ...

How can users create on-click buttons to activate zoom in and zoom out features in a Plotly chart?

I am currently working on an Angular application where I need to implement zoom in and zoom out functionality for a Plotly chart. While the default hoverable mode bar provides this feature, it is not suitable for our specific use case. We require user-cr ...

Ways to convert all keys to uppercase in an array of objects?

Is there a way to capitalize the first letter of every key in an array of objects? I attempted to achieve this with the code below, but it's not working as expected. Any suggestions or corrections are appreciated. #current code function capitalizeO ...

Upon updating AngularFire, an error is thrown stating: "FirebaseError: Expected type 'Ea', but instead received a custom Ta object."

I have recently upgraded to AngularFire 7.4.1 and Angular 14.2.4, along with RxFire 6.0.3. After updating Angular from version 12 to 15, I encountered the following error with AngularFire: ERROR FirebaseError: Expected type 'Ea', but it was: a c ...

How can I use a string variable in Angular 2 to create a dynamic template URL

@Component({ selector: 'bancaComponent', templateUrl: '{{str}}' }) export class BancaComponent implements OnInit { str: String; constructor(private http: Http) { } ngOnInit(): void { this.str = "./file.component.html"; } An ...

What is the relationship between Typescript references, builds, and Docker?

I am facing a dilemma with my projectA which utilizes a common package that is also needed by my other Nodejs services. I am unsure of the best approach to package this in a Docker file. Ideally, running tsc build would compile both the project and the dep ...

The flexibility of adjusting the percentage in the ng-circle-progress feature

Currently, I am utilizing ng-cycle-progress in my Angular progress. Here is the HTML code: <circle-progress [percent]="score" [radius]="100" [outerStrokeWidth]="16" [innerStrokeWidth]="8" [outerStrokeColor]="'#78C000'" [innerStrok ...

Give your screen a quick swipe with Ionic's pull-to-refresh

Is there a way to bring the footer of an ionic app closer for refresh or loading more content? I am particularly curious about how to implement the 'pull up to refresh' feature using HTML, CSS, or the Ionic content component. ...

Typescript: Managing nested arrays of objects

I am working with a sample array of objects as shown below: let arr = [{id: 1,name: 'Test',segment: 'test',subCategory: [{id: 1,name:'Test1',segment:'test1'}]}] My goal is to reformat this array into the following s ...