Challenges encountered while deploying a NextJS project with TypeScript on Vercel

Encountering an error on Vercel during the build deploy process. The error message says:

https://i.stack.imgur.com/Wk0Rw.png

Oddly, the command pnpm run build works smoothly on my PC. Both it and the linting work fine. Upon inspecting the code, I noticed that both types here are numbers:

https://i.stack.imgur.com/D6C1j.png

https://i.stack.imgur.com/UIfhW.png

No errors are being reported on this line even after using parseInt on idValue.

Attempts made to resolve the issue:

  • Tried redeploying without Vercel cache (unchecked the option when redeploying).

  • Cleared git cache with git rm -r --cached .

  • Tested converting the variable to a string. In local code, compatibility issues were raised, but on Vercel, a new error appeared in another field with the same problem.

Had set up GitHub Actions, but disabled it thinking it might be causing the issue, but no luck.

Sharing my repo link for assistance: https://github.com/KajiyamaVK/ipve/

The error path is specified in the folder.

EDIT:

Removing parseInt resulted in the component requesting a number as expected.

https://i.stack.imgur.com/LzegZ.png

SOLUTION

Resolved by deleting node_modules and reinstalling pnpm. All errors became visible afterwards.

Answer №1

After reviewing your code, I noticed that the data types were not properly set up. Specifically, the prop id in the TableRow component is expecting a string, but you have provided it with a number as indicated in line 289

 const idValue = parseInt(row.getValue('id'));

Instead of converting idValue to a number, keep it as a string. You can then convert idValue to a number on line 296.

Replace line 288 to line 312 with the following code block:

 table.getRowModel().rows.map((row) => {
                const idValue: string = row.getValue("id");
                return (
                  <TableRow
                    key={row.id}
                    id={idValue}
                    className="hover:bg-primary-dark hover:text-primary-foreground cursor-pointer "
                    data-state={row.getIsSelected() && "selected"}
                    onClick={() => handleViewState(parseInt(idValue))}
                  >
                    {row.getVisibleCells().map((cell) => renderTableCell(cell))}
                    <TableCell className="flex gap-2 cursor-pointer">
                      <button
                        aria-label="Deletar"
                        onClick={(e) => {
                          e.stopPropagation();
                          handleDelete(parseInt(idValue));
                        }}
                      >
                        <Trash size={24} />
                      </button>
                    </TableCell>
                  </TableRow>
                );
              })

Answer №2

After deleting the node_modules folder and recreating it, I experienced a sudden surge of errors on my local machine.

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

Encountering an error with the Next Auth adapter in TypeScript when attempting to modify the default User interface

This is my first time using TypeScript and I am attempting to customize the default User interface for next-auth. I have experimented with the following code: next-auth.d.ts import { User } from "next-auth" import { JWT } from "next-auth/j ...

Attempting to establish a connection with MongoDB through Realm

Exploring Realm and MongoDB for the first time has been an interesting journey for me. I began by following a helpful tutorial as a starting point for my project. Here is the link to my project structure on CodeSandbox The folder structure includes: src ...

What is the best way to associate dates with a particular ID within a textfield's value?

I am working with an array of objects called dates, and each object in the array looks like this: {id: 9898, date: 10/06/2020}. Within this array, there are multiple objects with the same id, and I want to display dates with the same id in a TextField com ...

Issue: ERROR! Unable to locate bash ENOENT & ERR! system call spawn bash

Encountering errors while trying to set up a new React or Next app on my computer. I've attempted various troubleshooting steps, including adding the path "C:\Windows\System32", but the issue persists. Running node v16.13.2 and npm v8.4.0, ...

Framer Motion's "repeatType" property triggering a TypeError

Every time I try to add the repeatType property in my transition, I encounter an error related to the variants prop: index.d.ts(2779, 5): The expected type comes from property 'variants' which is declared here on type 'IntrinsicAttributes ...

Has the caching and revalidating feature in Next.js 13.4 stopped working?

Just dipping my toes into the world of Next and React. Can you help me figure out if it's a bug or something I'm doing wrong? I've put together this app with Next 13.4.2: Check out the Demo /app/[id]/page.tsx export const revalidate = 0; ex ...

Creating a flexible TypeScript function handler that accepts optional arguments depending on the function's name

I am facing a challenge with defining the function type for running helper functions that prepare database queries. Some of these functions have arguments, while others do not. TS Playground Link type PreparedQuery = { query: string; params?: string[] ...

Applying ngClass to a row in an Angular material table

Is there a way I can utilize the select-option in an Angular select element to alter the css-class of a specific row within an Angular Material table? I have successfully implemented my selection functionality, where I am able to mark a planet as "selecte ...

Ways to receive one of two variations

Dealing with different cases for type is my current challenge. In a React Functional Component, I have a callback function property that accepts an argument of either string or number. interface InputProps { getValue?: (value: string | number) => vo ...

Setting default values for class members in Typescript is important for ensuring consistent behavior and

My model is pretty straightforward: export class Profile extends ServerData { name: string; email: string; age: number; } Whenever I make a server call using Angular 4's $http, I consistently receive this response: { name: string; email: ...

Instructions on transferring JSON data to clipboard using a button

How can I copy JSON data to clipboard using a button click? { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ ... ], "Resource": "*" } ] } I attempted to ...

Is there a syntax available for type annotation of arrays created from pre-declared variables?

According to my standards, all possible annotations are required in TypeScript. Therefore, TypeScript-ESLint is prompting me to annotate the `[ responseData, cognitoUser ]`. However, when I try to use the syntax `[ responseData1: ResponseData1, responseD ...

What are the reasons behind the unforeseen outcomes when transferring cookie logic into a function?

While working on my express route for login, I decided to use jwt for authentication and moved the logic into a separate domain by placing it in a function and adjusting my code. However, I encountered an issue where the client side code was unable to read ...

How can I display a new module in Angular without navigating to it?

After following the tutorial at https://angular.io/guide/lazy-loading-ngmodules#create-a-feature-module-with-routing I set out to create the following: My goal is to have a dedicated module for all customer-related components accessible through the /cust ...

searchByTextContentUnderListItemAnchorTag

I would like to utilize the getByRole function for writing my test. However, I am encountering issues when using linkitem or 'link' as the role. It seems that I cannot find the desired element. // encountered error TestingLibraryElementError: The ...

Tips for excluding the "use client" term in the upcoming 13 using Material UI

I'm encountering an issue while developing a server-rendered app in next.js 13. Whenever I attempt to import a material ui component within the layout.jsx or any other file, I encounter an error. The error message states that I am importing a componen ...

What is the best way to access data from a local JSON file in Gatsby when using TypeScript and GraphQL?

I'm updating my former gatsby site using TypeScript. I encountered an issue while trying to retrieve data from a local JSON file: There appears to be an error in your GraphQL query: Cannot find field "allNavigationLinksJson" on type "Q ...

What could be causing the favicon in my Next.js application to not function properly?

My favicon doesn't seem to be working properly. I've saved the favicon file as favicon.ico in the /public directory and have included a reference to it in the <Head> section of my pages (which are located in the /pages directory), but it s ...

Electron does not have the capability to utilize Google's Speech to Text engine

I am trying to connect my microphone with the Google Speech to Text engine. I came across this page and copied the code into my renderer.ts file, uncommented the lines with const, but when I run it, I encounter an error at line 7 (const client = new speech ...

Angular route fails to load the HTML file

In the process of developing a route within an Angular application, I have successfully implemented 3 routes. However, one particular route is giving me trouble. I have three folders that need to redirect HTML based on the option chosen. In Angular, I cre ...