Comments (3)
@nurul3101 Your understanding is correct. Not only that, but I also tested your hypothesis, and it's right.
I commented out UserPreview
in users/[slug].tsx
and no error was thrown. I started to debug and noticed that nothing inside that JSX component was the problem.
The problem was that I had import prisma from "@/lib/prisma";
and
export const getPublicUser = async (where: Prisma.userWhereUniqueInput) => {
const userUnique = prisma.user.findUniqueOrThrow({
...
in the same file where the UserPreview
component was defined (components/User/Preview/index.tsx
)
So I used components/User/Preview/index.tsx
only for the JSX and moved getPublicUser
to another file, and the error is gone, fixed!
I'm just wondering, why isn't the behavior the same between using Accelerate and not using it? Even though the problem is fixed, should I expect any changes in how Accelerate affects the """bundle""" (I'm unaware of the correct term as I'm ignorant of what's actually happening under the hood) to be able to use my original code, or is this code refactoring expected when using Accelerate?
from prisma.
Hey @walterdiazesa 👋
Thank you for raising this.
If I understand this correctly, Prisma Accelerate works as expected for your one route (pages/works/[slug]/index.tsx
) but it doesn't for the other route (pages/users/[slug].tsx
) correct?
I see that in your users/[slug].tsx
you are importing a component called UserPreview
which I assume returns some JSX?
Could you temporarily comment usage of UserPreview
in the users/[slug].tsx
file and check if you still get the error? My assumption is that the error is caused in components/User/Preview/index.tsx
file.
from prisma.
I am glad to hear that the hypothesis was correct. I believe the code refactoring is expected, because UserPreview component - components/User/Preview/index.tsx
is rendered on client side and is not server side rendered. The database interactions need to happen on the server side. Previously you were doing database calls in getPublicUser
function which was on client side, which caused the error. As soon as you changed the location of the function to be outside the client rendered component, the issue was resolved.
from prisma.
Related Issues (20)
- createManyAndReturn include do not work with relations defined on other table HOT 1
- [SQLite] Bug in `prismaSchemaFolder`: Incorrect Database File Generation and Missing Table Error HOT 1
- Selection with `_count: undefined` not working properly HOT 3
- No more enums generated HOT 1
- Create only is applying the migration
- Generic Types for Abstraction HOT 1
- Multi scheme for multi tenant architecture HOT 3
- API Key validations started failing over the last 24h HOT 1
- One model to multiple database schemas for multi-tenancy HOT 2
- @prisma/client is not in the npm registry, or you have no permission to fetch it.
- ConnectorError: 42P05 occurs frequently HOT 9
- Prisma relation query and connect behave strangely with composite relations
- prisma difficulty with accelerate HOT 1
- findMany returns integer instead of floats HOT 3
- Multiple concurrent raw queries lead to timeouts HOT 2
- Raw Query with $executeRaw Fails When Using Variable in SQL CREATE SEQUENCE
- Better error serialization (stack traces)
- groupBy include/select by aggregate field
- Raw Query Throws an Error in Release 5.17.0 HOT 5
- Error thrown using PrismaClient in Cloudflare Pages project HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma.