Comments (8)
I change to use this repo - https://github.com/zsnmwy/prisma-data-proxy
I fork from https://github.com/OnurGvnc/prisma-data-proxy
And make it works with Prisma 4.x.x
. Even the latest version - 4.16.2
.
It works well now.
And I create a guide repo to tell you how to use it. Works with any serverless env.
But I did not test with Prisma 5.x.x
, especially forjsonProtocol
.
I will do some work and make it works with Prisma 4.x.x - 5.x.x
.
Based on the official docs, the jsonProtocol
improves huge query performance.
from prisma-data-proxy-alt.
The JSON-type field needs the string in response, not the Object.
from prisma-data-proxy-alt.
So that means we need to stringify the object once again
from prisma-data-proxy-alt.
I have some testing base on my fork repo.
I added some tests for the JSON field. They passed. And the object has been stringified to string.
Like:
{
"data": {
"findManyProduct": [
{
// It works
"skus": "[{\"Url\":\"https://www.x.com.my/-i3677532048-s20852161423.html\",\"SkuId\":20852161423,\"price\":110,\"Images\":[\"https:x/p/de4e4473949b6e15d805096f2ffe22b5.jpg\"],\"Status\":\"active\",\"ShopSku\":\"3677532048_MY-20852161423\",\"quantity\":198,\"saleProp\":{\"color_family\":\"Black\"},\"SellerSku\":\"aw110-Black\",\"tax_class\":\"75586\",\"color_family\":\"Black\",\"package_width\":\"10.00\",\"special_price\":56.19,\"package_height\":\"10.00\",\"package_length\":\"10.00\",\"package_weight\":\"0.1\",\"package_content\":\"1 * One pair of bluetooth headsets1 * Charging case1 * Charging cable1 * User manual\",\"channelInventories\":[],\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"quantity\":198,\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\",\"occupyQuantity\":0,\"sellableQuantity\":198,\"withholdQuantity\":0}]}]"
}
]
}
}
But If I use this package in another repo base on Dockerfile, the response is not stringified.
I'm so confused.
Can you reproduce it if you have free time?
I provide some steps for you. Easy and quick.
docker compose -f "docker-compose.yml" up -d --build
![image](https://private-user-images.githubusercontent.com/35299017/248594248-9228cba1-711e-4c1b-89bc-07dbfe9c3d10.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg3MDkyNDksIm5iZiI6MTcwODcwODk0OSwicGF0aCI6Ii8zNTI5OTAxNy8yNDg1OTQyNDgtOTIyOGNiYTEtNzExZS00YzFiLTg5YmMtMDdkYmZlOWMzZDEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIzVDE3MjIyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5ZDRjNzkyZDBhYjI0MDJlOThhMjkyMjRjYTFjZTU4MjgyNWM3ZGRiZmUyNzA0YTExZGVmN2NhZTM2NWYzMGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FvABBvs7Cvrj8Q_EjF57qzYGOWKrQlasKgjBiATMSxI)
- View Logs - graphql
![image](https://private-user-images.githubusercontent.com/35299017/248594575-c108b216-4f59-4297-97b7-4239eb217414.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg3MDkyNDksIm5iZiI6MTcwODcwODk0OSwicGF0aCI6Ii8zNTI5OTAxNy8yNDg1OTQ1NzUtYzEwOGIyMTYtNGY1OS00Mjk3LTk3YjctNDIzOWViMjE3NDE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIzVDE3MjIyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0OWI1Njg1M2NmODdlYjkzMWYwMmJiZDljNzUyYzhiZmVkYzFhZmIyZGExNzUyZmUzNTMyZWI1MDZkMjdmMjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6w6jK5d398aiXHB8facDVYSDhux-S5sS1wfwxUJjDeo)
- Attach Shell - test
- Exec
yarn test
in the test shell
![image](https://private-user-images.githubusercontent.com/35299017/248594591-1cddbbc7-a4b5-4c5d-83d6-cd6d9e7f1288.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg3MDkyNDksIm5iZiI6MTcwODcwODk0OSwicGF0aCI6Ii8zNTI5OTAxNy8yNDg1OTQ1OTEtMWNkZGJiYzctYTRiNS00YzVkLTgzZDYtY2Q2ZDllN2YxMjg4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIzVDE3MjIyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBjNTk0ZGM1OTQ2MmRjMDZmYWJjMjFmNzg2ZDY4NmMwOWQzMGQwOTVjZTU3OTkzZGE3YzFkYzQyM2ViYzUwYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.P2pY_Gk0o37oge0sqkYlcqSv455H0psbcRmpNrDxUjk)
prisma:query SELECT "public"."Product"."id", "public"."Product"."attr", "public"."Product"."skus" FROM "public"."Product" WHERE "public"."Product"."id" = $1 LIMIT $2 OFFSET $3
prisma:query COMMIT
Response
{
"data": {
"createOneProduct": {
"id": 2,
"attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
"skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
}
}
}
prisma:query SELECT "public"."Product"."id", "public"."Product"."attr", "public"."Product"."skus" FROM "public"."Product" WHERE 1=1 OFFSET $1
Response
{
"data": {
"findManyProduct": [
{
"id": 1,
"attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
"skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
},
{
"id": 2,
"attr": "{\"a\":123,\"b\":true,\"c\":{\"d\":\"hello\"}}",
"skus": "[{\"Url\":\"https://www.x.com.x/-x-x.html\",\"SkuId\":20852161423,\"Images\":[\"https://x.net/p/x.jpg\"],\"saleProp\":{\"color_family\":\"Black\"},\"fblWarehouseInventories\":[],\"multiWarehouseInventories\":[{\"totalQuantity\":198,\"warehouseCode\":\"dropshipping\"}]}]"
}
]
}
}
- The response is correct if you log the response.
![image](https://private-user-images.githubusercontent.com/35299017/248594739-b9711732-2ed9-4a82-bf8d-ead1f1c7a2f3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg3MDkyNDksIm5iZiI6MTcwODcwODk0OSwicGF0aCI6Ii8zNTI5OTAxNy8yNDg1OTQ3MzktYjk3MTE3MzItMmVkOS00YTgyLWJmOGQtZWFkMWYxYzdhMmYzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIzVDE3MjIyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWExMzZiYzliZGM0YWNiMWY4Mjc4MzM4YTE5ODY1NGRlODg2ZDA5MzYyNWFhM2EzOGEzNzA1MzEyOTRjN2E3YTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FquJEC_nh8d_f-R511EdzWp1VnsCoC4-rjFX4iHgazU)
from prisma-data-proxy-alt.
@zsnmwy What is the state of your fork? It doesn't look like this library is being maintained and might require significant work with the new jsonProtocol
.
from prisma-data-proxy-alt.
I'd look into it this weekend
from prisma-data-proxy-alt.
@mbrimmer83
Now it supports Prisma 5.0
, especially for jsonProtocol
.
More detail in repos.
https://github.com/zsnmwy/prisma-data-proxy-windmill-template
https://github.com/zsnmwy/prisma-data-proxy
from prisma-data-proxy-alt.
@mbrimmer83 Now it supports
Prisma 5.0
, especially forjsonProtocol
. More detail in repos. https://github.com/zsnmwy/prisma-data-proxy-windmill-template https://github.com/zsnmwy/prisma-data-proxy
Oh wow, I'm gonna test it out this weekend. I'll let you know how it goes. This is awesome. Thanks!!
from prisma-data-proxy-alt.
Related Issues (20)
- Support Prisma v4
- Add a example and a document section for deployment to Lambda HOT 2
- Allow to include generated GraphQL schema for Vercel
- Improve the execution point of `getSchemaSync`
- Error opening a TLS connection (unable to get local issuer certificate) HOT 12
- Cannot access data whose model name begins with a lowercase letter HOT 2
- Different Graphql Server? HOT 3
- Does this data proxy support `include`? HOT 2
- Can you provide more details about the benchmark setup? HOT 3
- Prisma Client Docker Build errors HOT 2
- Recieved corrupt message when running locally HOT 3
- Not working in Vercel HOT 4
- Do not know how to serialize a BigInt
- Any idea how to run it in a Cloudflare Worker ? HOT 2
- GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension. HOT 1
- Will this work with jsonProtocol? HOT 1
- Support plannetscale database HOT 1
- Connection Pooling/Management HOT 1
- Prisma 5 support?
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-data-proxy-alt.