The specified column `EventChart.åå` is not found within the existing database

I've been developing a dashboard application using Prisma, Next.js, and supabase.

Recently, I encountered an issue when making a GET request. Prisma throws an error mentioning a column EventChart.åå, with a strange alphabet "åå" that I haven't used anywhere in my code.

This is the specific error message:

PrismaClientKnownRequestError: 
Invalid `prisma.eventChart.findMany()` invocation:

The column `EventChart.åå` does not exist in the current database.
    at ai.handleRequestError (/Users/name/Desktop/unien-dashboard-app/unien-dashboard/dashboard/node_modules/@prisma/client/runtime/library.js:126:6775)
    at ai.handleAndLogRequestError (/Users/name/Desktop/unien-dashboard-app/unien-dashboard/dashboard/node_modules/@prisma/client/runtime/library.js:126:6109)
    at ai.request (/Users/name/Desktop/unien-dashboard-app/unien-dashboard/dashboard/node_modules/@prisma/client/runtime/library.js:126:5817)
    at async l (/Users/name/Desktop/unien-dashboard-app/unien-dashboard/dashboard/node_modules/@prisma/client/runtime/library.js:131:9709)
    at async GET (webpack-internal:///(rsc)/./app/api/eventChart/route.ts:18:27)
    at async /Users/name/Desktop/unien-dashboard-app/unien-dashboard/dashboard/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:63251 {
  code: 'P2022',
  clientVersion: '5.9.1',
  meta: { modelName: 'EventChart', column: 'EventChart.å\x8F\x82å\x8A' }
}

Snippet from route.ts file:

import { NextResponse } from "next/server"
import { main } from "../route"
import { PrismaClient } from "@prisma/client"

const prisma = new PrismaClient

export const GET = async (req: Request, res: NextResponse ) => {
    try {
      await main()
      const eventData = await prisma.eventChart.findMany({
        select: {
          date: true,
          userId: true,
          actual: true,
          expected: true,
        }
      })
      return NextResponse.json({ message: "Success", eventData }, {status: 200})
    } catch (err) {
      console.error('Error in GET method:', err);
      return NextResponse.json({ message: "Error", err }, {status: 500})
    } finally {
      await prisma.$disconnect()
    }
  }

Excerpt from schema.prisma:

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_DATABASE_URL")
}

model User {
  id          Int @id @default(autoincrement())
  username    String @unique
  password    String
  email       String
  fees        Fee?
  eventChart  EventChart[]
  eventAreaChart  EventAreaChart[]
  memberChart MemberChart[]
  task        Task[]
  event       Event[]
}

...

Trying to fetch data:

"use client"
...

<h1>Attempts Made:</h1>
<p>・When I removed the <code>actual and expected columns, the GET method worked as expected.

import { NextResponse } from "next/server"
import { main } from "../route"
import { PrismaClient } from "@prisma/client"

const prisma = new PrismaClient

export const GET = async (req: Request, res: NextResponse ) => {
    try {
      await main()
      const eventData = await prisma.eventChart.findMany({
        select: {
          date: true,
          userId: true,
          // actual: true,
          // expected: true,
        }
      })
      return NextResponse.json({ message: "Success", eventData }, {status: 200})
    } catch (err) {
      console.error('Error in GET method:', err);
      return NextResponse.json({ message: "Error", err }, {status: 500})
    } finally {
      await prisma.$disconnect()
    }
  }

・I tried renaming the problematic columns following Prisma's documentation, which had resolved a similar issue with another model but was unsuccessful this time.

I've spent a week troubleshooting this problem without any progress, so I would greatly appreciate any assistance or insights you can provide. Thank you!

Answer №1

After updating to prisma version 5.10.1, the issue was successfully resolved.

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

The value of the cookie is not set (version 2.0.6 of react-cookie)

I am encountering an issue with implementing react cookies version 2. I am using webpack-dev-server for testing. Below is the console log: Warning: Failed context type: The context cookies is marked as required in withCookies(App), but its value is unde ...

Encountering an issue with PrimeNG's <p-calendar> component: the error message "date

I encountered an issue resulting in the following error message: core.es5.js:1020 ERROR Error: Uncaught (in promise): TypeError: date.getMonth is not a function TypeError: date.getMonth is not a function This error occurs whenever I attempt to implement ...

Encountering difficulties with properly storing an array in MongoDB using Node.js and Mongoose

Can you point me in the right direction on how to properly store an array of data in mongodb using node/mongoose? I'm currently facing an issue where all my data is being saved as the first value in the array. Here's a snippet of my code: const ...

Tips for displaying only the initial 15 characters of a text value

The content extracted from a .ts file is being displayed on the home.html page. I am aiming to display only the initial 15 characters followed by 3 dots (...). Despite my efforts, the following code snippet is not functioning as expected: home.html < ...

What's up with this unconventional jQuery formatting? Can someone shed some light on

I recently found a plugin that toggles checkboxes, but unfortunately it's not functioning correctly with the latest version of jQuery so I'm currently working on debugging it. Could someone please provide an explanation for the following code sn ...

What is the method to determine the duration of a video using the FileReader function to access the video file?

My current challenge involves uploading a video to a server and reading it on the client end using `readAsBinaryString()` from FileReader. However, I am facing an issue when trying to determine the duration of this video file. If I attempt to read the fi ...

Removing a Django object via AJAX or JavaScript with a confirmation prompt

Greetings! I am looking to implement a feature in Django where I can delete an object using AJAX or JavaScript with a confirmation message upon clicking the delete button. However, I am struggling to complete the AJAX request. Here is the code in views.py ...

Utilize the client-side JavaScript file with ejs framework

Recently, I have been working on creating a website using Express and EJS. I discovered that using just one JavaScript file for all my EJS (view) files was causing issues. If I target a DOM element in one view page and it doesn't exist in another, I w ...

After implementing ajax, jQuery ceases to function

I have been working with multiple JavaScript files and everything is functioning perfectly (including functions that add styles to elements), but I am encountering an issue when trying to include the following script: <script src="http://ajax.googleapi ...

The most effective method for incorporating a header and footer into an HTML page utilizing a variety of client-side frameworks

Looking for a solution for my HTML project where I want to incorporate a header and footer to minimize rework. Any suggestions on a good approach? I have experimented with AngularJS using ng-include, and here is the code snippet: var app = angular.module ...

When attempting an Axios request, the backend method cannot be accessed

I am facing an issue when using Axios request to access a method in the backend. I am constrained by pre-existing code in both frontend and backend that limits how much I can modify or add. Frontend: const response = await axiosConfig.put<IReserved&g ...

Extract data from CSV files with line breaks in fields using JavaScript

When dealing with a CSV file that has newline or return characters in certain fields, the challenge is to parse the data without accidentally splitting a field into multiple rows. Here is an example of CSV data: ID;Name;Country;ISO-2;Address;Latitude;Lon ...

Chrome compatibility problem with scroll spy feature in Bootstrap 3

Having trouble with scroll spy for boosters using the body method " data-spy="scroll". It seems to be working for some browsers like Edge and Google Chrome, but after multiple attempts, it still doesn't work for me. Even after asking friends to test i ...

How can I nest a kendo-grid within another kendo-grid and make them both editable with on-cell click functionality?

I am facing an issue with my 2 components - trial1 (parent kendo-grid) and trial2 (child kendo-grid). Inside the template of trial1, I referenced the sub-grid component trial2. However, I am encountering an error where trial2 is not recognized inside trial ...

Is it possible to load images top to bottom?

Is there a way to make browsers load images from the bottom to the top? Imagine I have an extremely long image that takes 60 seconds to load. The content is designed to be read from bottom to top. Is there any trick I can use to ensure that the image load ...

Using a template literal as a prop is causing rendering issues

I have a functional component const CustomParagraph = forwardRef((ref: any) => { return ( <div> <p dangerouslySetInnerHTML={{ __html: props.text }}></p> </div> ); }); Whenever I use this component, I am unable ...

Is it possible to trigger a function using an event on "Any specified selector within a provided array"?

Trying to figure out how to show/hide a group of divs with different IDs by executing a function after creating an array of IDs for the NavBar. I'm having trouble getting started, but here's what I was thinking: $.each(array1, function(i, value) ...

What steps are needed to develop a TypeScript component within Angular framework?

I've been attempting to develop an Angular Component in TypeScript. I'm trying to utilize document.createElement to build a toolbar within my component, but it's not appearing. Below is my Component code: import {Directive, Component, boot ...

Typescript Code Coverage with karma-jasmine and istanbul: A complete guide

I am attempting to calculate the Code Coverage for my typescript Code in karma framework using Istanbul. In the karma.conf file, typescript files are added and through karma typescript-preprocessor we are able to conduct unit testing and code coverage of t ...

typescript function intersection types

Encountering challenges with TypeScript, I came across the following simple example: type g = 1 & 2 // never type h = ((x: 1) => 0) & ((x: 2) => 0) // why h not never type i = ((x: 1 & 2) => 0)// why x not never The puzzling part is w ...