aiji42 / prisma-data-proxy-alt Goto Github PK
View Code? Open in Web Editor NEWThis is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io)
License: MIT License
This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io)
License: MIT License
Does this data proxy support include
?
I tried this query:
const leaderboardRows = await prisma.leaderboard_row.findMany({
include: {
profile: true,
},
where: {
leaderboard_id: leaderboardId,
},
skip: start - 1,
take: count,
orderBy: {
['rank']: 'asc',
},
});
and got:
Invalid `prisma.leaderboard_row.findMany()` invocation:
Cannot return null for non-nullable field leaderboard_row.profile.
Data proxy logs:
prisma:query SELECT 1
prisma:query SELECT "public"."leaderboard_row"."leaderboard_id", "public"."leaderboard_row"."profile_id", "public"."leaderboard_row"."name", "public"."leaderboard_row"."rank", "public"."leaderboard_row"."rating", "public"."leaderboard_row"."last_match_time", "public"."leaderboard_row"."drops", "public"."leaderboard_row"."losses", "public"."leaderboard_row"."streak", "public"."leaderboard_row"."wins", "public"."leaderboard_row"."updated_at", "public"."leaderboard_row"."rank_country" FROM "public"."leaderboard_row" WHERE "public"."leaderboard_row"."leaderboard_id" = $1 ORDER BY "public"."leaderboard_row"."rank" ASC LIMIT $2 OFFSET $3
When I removed the include
the query succeeded:
const leaderboardRows = await prisma.leaderboard_row.findMany({
// include: {
// profile: true,
// },
where: {
leaderboard_id: leaderboardId,
},
skip: start - 1,
take: count,
orderBy: {
['rank']: 'asc',
},
});
First of all, thanks for sharing this project!
It works great, but I found one issue: when running a postgres query that returns a BigInt column, the query fails with the following error: "Do not know how to serialize a BigInt"
Further digging shows that the error originates in apollo-server-core:
TypeError: Do not know how to serialize a BigInt
at prettyJSONStringify (/app/node_modules/apollo-server-core/dist/runHttpQuery.js:314:17)
at processHTTPRequest (/app/node_modules/apollo-server-core/dist/runHttpQuery.js:233:20)
Hi ! I'm trying to run a minimal Prisma data proxy in a Cloudflare Worker and was considering doing this using this project.
Does anyone has already achieved something similar or have informations that could help me ?
Thanks :)
Is there any specific reason for using apollo-server? It adds a bunch of overhead that is not needed?
Has this been tested? Does it affect speed improvements?
Making a request from the client to a table that has a JSON type field throws an error SyntaxError: "[object Object]" is not valid JSON.
Note that a console log at afterMiddleware.ts
below JSON.parse shows the correct data being returned
Generate schema and resolver locally and allow import on app server.
(@prisma/sdk
does not work with Vercel)
Hi, thank you for your work on this project, it's been a real help using Prisma with Deno.
However, when trying to use the proxy I get an error:
Cannot fetch data from service:
error sending request for url (https://localhost:3851/4.7.1/b7b4fb7095922bd7b7c1126f4ffb522c4a94a7c7baa9310b74ef3789231d8756/graphql): error trying to connect: received corrupt message
at wn.handleRequestError (file:///.../backend/generated/client/runtime/edge-esm.js:80:18717)
at wn.handleAndLogRequestError (file:///.../backend/generated/client/runtime/edge-esm.js:80:18249)
at wn.request (file:///.../generated/client/runtime/edge-esm.js:80:18087)
at async t._request (file:///.../backend/generated/client/runtime/edge-esm.js:97:2022)
at async file:///.../backend/src/prisma.ts:27:15
Watcher Process finished. Restarting on file change...
First thing I noticed was that it was trying to use https://
. Is this perhaps the issue?
I put a console.log in the beforeMiddleware.js to log every request. Requests sent manually via curl to the proxy-alt server log to the console, but when using the Prisma client nothing gets logged, possibly indicating it never actually reached the server. I have a feeling it's expecting an https response and getting an http one, or something along those lines.
I'd like to run the proxy on localhost for integration tests :)
Is there going to be a Prisma version 5 support?
Facts:
Solution:
Maybe update the prisma version? I have tired change the version in package.json, and then run build, but it occured error when building.
Executing getSchemaSync
at server startup may slow things down somewhat.
Hello,
I have tried using the docker-compose.yml
, and Dockerfile
example, and none have worked even though the prisma generate
command is ran.
Docker container output log
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In my package.json
I have the following versions of Prisma.
"@prisma/client": "^4.7.1",
"prisma": "^4.7.1",
Could the aforementioned Prisma version be causing the issue?
Is Prisma version v4.0.0 the only version that is currently compatible?
Does this library provide external connection polling/management functionality?
On prisma: [https://www.prisma.io/docs/data-platform/data-proxy#connection-pooling-and-connection-management](data proxy docs):
Data Proxy provides connection pooling so that your application can reuse active connections and never exhaust the maximum number of connections that your database allows.
Connection pooling with the Data Proxy utilizes orchestrated Prisma query engine technology to open, maintain, and close connection pools. It helps applications load-balance and scale database requests based on demand.
A Data Proxy connection pool maintains active database connections and ensures that an application reuses them when new requests come in.
After a quick look through the code, I don't see anything explicit about connection pooling/management, but perhaps this is handled under the hood?
If I self-host this prisma data proxy, will I have to use it in conjunction with https://www.prisma.io/docs/guides/performance-and-optimization/connection-management/configure-pg-bouncer as an external connection pooler?
I get this error when trying to query the database in a next js 13 server component
Hi,
I followed the documentation and created a docker-compose file with env variables set for the database (Planetscale Tokyo region), prisma schema path, data proxy API key and port.
When running docker compose up
, I get the following error:
...
prisma-data-proxy-alt-https-portal-1 | [cont-init.d] done.
prisma-data-proxy-alt-https-portal-1 | [services.d] starting services
prisma-data-proxy-alt-https-portal-1 | [services.d] done.
prisma-data-proxy-alt-data-proxy-1 | [3/4] Linking dependencies...
prisma-data-proxy-alt-data-proxy-1 | [4/4] Building fresh packages...
prisma-data-proxy-alt-data-proxy-1 | success Saved lockfile.
prisma-data-proxy-alt-data-proxy-1 | Done in 19.17s.
prisma-data-proxy-alt-data-proxy-1 | yarn run v1.22.19
prisma-data-proxy-alt-data-proxy-1 | $ /app/node_modules/.bin/pdp
prisma-data-proxy-alt-data-proxy-1 | prisma:info Starting a mysql pool with 9 connections.
prisma-data-proxy-alt-data-proxy-1 | ๐ฎ Alternative Prisma Data Proxy listening on port 3000
prisma-data-proxy-alt-data-proxy-1 | prisma:info Encountered error during initialization:
prisma-data-proxy-alt-data-proxy-1 | prisma:error
prisma-data-proxy-alt-data-proxy-1 | Error opening a TLS connection: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1914: (unable to get local issuer certificate)
prisma-data-proxy-alt-data-proxy-1 | /app/node_modules/@prisma/client/runtime/index.js:24071
prisma-data-proxy-alt-data-proxy-1 | const err = new PrismaClientInitializationError(json.message, this.clientVersion, json.error_code);
prisma-data-proxy-alt-data-proxy-1 | ^
prisma-data-proxy-alt-data-proxy-1 |
prisma-data-proxy-alt-data-proxy-1 | PrismaClientInitializationError: Error opening a TLS connection: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1914: (unable to get local issuer certificate)
prisma-data-proxy-alt-data-proxy-1 | at LineStream.<anonymous> (/app/node_modules/@prisma/client/runtime/index.js:24071:29)
prisma-data-proxy-alt-data-proxy-1 | at LineStream.emit (node:events:513:28)
prisma-data-proxy-alt-data-proxy-1 | at addChunk (node:internal/streams/readable:324:12)
prisma-data-proxy-alt-data-proxy-1 | at readableAddChunk (node:internal/streams/readable:297:9)
prisma-data-proxy-alt-data-proxy-1 | at Readable.push (node:internal/streams/readable:234:10)
prisma-data-proxy-alt-data-proxy-1 | at LineStream._pushBuffer (/app/node_modules/@prisma/client/runtime/index.js:20137:17)
prisma-data-proxy-alt-data-proxy-1 | at LineStream._transform (/app/node_modules/@prisma/client/runtime/index.js:20131:8)
prisma-data-proxy-alt-data-proxy-1 | at Transform._write (node:internal/streams/transform:175:8)
prisma-data-proxy-alt-data-proxy-1 | at writeOrBuffer (node:internal/streams/writable:392:12)
prisma-data-proxy-alt-data-proxy-1 | at _write (node:internal/streams/writable:333:10) {
prisma-data-proxy-alt-data-proxy-1 | clientVersion: '4.2.1',
prisma-data-proxy-alt-data-proxy-1 | errorCode: 'P1011'
prisma-data-proxy-alt-data-proxy-1 | }
prisma-data-proxy-alt-data-proxy-1 |
prisma-data-proxy-alt-data-proxy-1 | Node.js v18.7.0
prisma-data-proxy-alt-data-proxy-1 | error Command failed with exit code 1.
prisma-data-proxy-alt-data-proxy-1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
prisma-data-proxy-alt-data-proxy-1 exited with code 1
Do you happen to know the reason for that error?
I don't really understand what is meant with (unable to get local issuer certificate)
. Should that be on my local machine, in Docker or is that something on the Planetscale side? How do I create that?
I am on Mac OS Monterey 12.5
I would appreciate your help a lot!
Regards,
Oka
Hey ๐ ,
I am from Prisma and we learned about your awesome work today! Thanks for doing this for the open source community. ๐
We have also seen your interesting benchmarks. Can you provide more details about the setup? We would like to reproduce those results and need the schema file and the test data.
This would help us a lot in tracking this down and improving on our end.
pdp
to easily start the server
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.