Neo Lambada
11/18/2021, 11:50 AMJames
11/18/2021, 12:46 PM1,2,3
?Julien Goux
11/18/2021, 2:28 PMJulien Goux
11/18/2021, 2:28 PMAdrian
11/18/2021, 3:28 PMLars Ivar Igesund
11/18/2021, 3:33 PMsctnightcore
11/18/2021, 4:15 PMKelly Copley
11/18/2021, 4:39 PMAndy Kimball
11/18/2021, 4:50 PMPeter Takacs
11/18/2021, 4:53 PMElijah Rosier
11/18/2021, 5:04 PMserverless.yml
package:
individually: true
patterns:
- '!node_modules/@prisma/engines/prisma-fmt-debian-*'
- '!node_modules/@prisma/engines/introspection-engine-*'
- '!node_modules/@prisma/engines/libquery_engine-debian-*'
- '!node_modules/@prisma/engines/migration-engine-*'
- '!node_modules/typescript/**'
- '!node_modules/.prisma/client/query-engine-*'
- '!node_modules/.prisma/client/libquery_engine-*'
- 'node_modules/.prisma/client/libquery_engine-rhel-*'
which correctly keeps only the libquery_engine-rhel-openssl-1.0.x.so.node
binary
# /node_modules/@prisma/engines
total 51M
drwxr-xr-x 4 root root 4.0K Nov 18 16:28 .
drwxr-xr-x 5 root root 4.0K Nov 18 16:28 ..
-rw-r--r-- 1 root root 537 Jan 1 1980 README.md
drwxr-xr-x 2 root root 4.0K Nov 18 16:28 dist
drwxr-xr-x 2 root root 4.0K Nov 18 16:28 download
-rwxr-xr-x 1 root root 42M Jan 1 1980 libquery_engine-rhel-openssl-1.0.x.so.node
-rw-r--r-- 1 root root 774 Jan 1 1980 package.json
-rwxr-xr-x 1 root root 8.6M Jan 1 1980 prisma-fmt-rhel-openssl-1.0.x
However, once deployed and I attempt to access the endpoint I receive the following error in CloudWatch:
ERROR PrismaClientInitializationError:
Invalid `prisma.executeRaw()` invocation:
Query engine library for current platform "rhel-openssl-1.0.x" could not be found.
You incorrectly pinned it to rhel-openssl-1.0.x
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/var/task/node_modules/@prisma/client/runtime/libquery_engine-rhel-openssl-1.0.x.so.node")
Searched Locations:
/var/task/node_modules/.prisma/client
/actions-runner/_work/listener-suite/listener-suite/backend/node_modules/@prisma/client
/var/task/node_modules/@prisma/client
/var/task/node_modules/.prisma/client
/var/task/node_modules/.prisma/client
/tmp/prisma-engines
/var/task/node_modules/.prisma/client
To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
Then run "prisma generate" for your changes to take effect.
Read more about deploying Prisma Client: <https://pris.ly/d/client-generator>
at cb (/var/task/node_modules/@prisma/client/runtime/index.js:38508:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Promise.all (index 0) {
clientVersion: '3.4.2',
errorCode: undefined
}
Is there a way to define the search path, or is there something else I'm doing completely wrong. Apologies for my ignorance, I'm new to using Prisma. Also another note, somehow our zipped lambda is 80MB, even with all of my custom excludes in the serverless.yml
(is this normal with Prisma in AWS?)Muzaffar Hussain
11/18/2021, 5:31 PMuser
11/18/2021, 5:34 PMjoao.santos
11/18/2021, 6:51 PMSabin Adams
11/18/2021, 7:24 PMPierre Ortega
11/18/2021, 7:29 PMPierre Ortega
11/18/2021, 7:30 PMgenerator client {
provider = "prisma-client-js"
output = "./db1/__generated__/"
}
... another schema file ...
generator client {
provider = "prisma-client-js"
output = "./db2/__generated__/"
}
Pierre Ortega
11/18/2021, 7:31 PMimport { PrismaClient as DB1PrismaClient } from './db1/__generated__';
import { PrismaClient as DB2PrismaClient } from './db2/__generated__';
Sabin Adams
11/18/2021, 7:48 PMSabin Adams
11/18/2021, 7:50 PMSELECT * FROM dbo.Contacts
SELECT * FROM geo.Locations
I have two schemas here, dbo
and geo
. I'm trying to find out if there's a way to access these via prisma without having to generate a completely different client just for the geo schemaNathaniel Babalola
11/18/2021, 10:04 PMimport { PrismaClient } from '@prisma/client';
import { DMMFClass } from '@prisma/client/runtime';
const prisma = new PrismaClient();
const dmmf = ((prisma as any)._dmmf as DMMFClass);
Danny
11/18/2021, 11:00 PMimport type { Group } from '@prisma/client';
import type { Group } from 'prisma/prisma-client';
Kervin Vasquez
11/19/2021, 7:36 AMusers
should I just be returning ctx.db.users.findMany() ? Could this approach have repercussions in performance given that it would be fetching all records ? I'm just not sure what return ctx.users.resolveForConnection(root, args, ctx, info)
means in the example.Kay Khan
11/19/2021, 11:03 AMperson
game
games_played
and images
The query below finds all the games a person has played and within the game
table their is a cover_id
which is a FK to the images
table.
When i generate the prisma sdk, you can see that this relationship between game
and images
is identified with the following name image_game_cover_idToimage
image_game_cover_idToimage image? @relation("game_cover_idToimage", fields: [cover_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_c529e54ccb5e986f6e8bc52f169b42fe")
can someone explain to me how this naming convention is chosen here and if its possible to give this a different name.
const result = await db.games_played.findMany({
where: { entity_id: person.id },
distinct: ["game_id"],
include: { game: { include: { image_game_cover_idToimage: true } } },
});
I guess the kind of solution im looking for is something like;
from: { include: { image_game_cover_idToimage: true } }
to: { include: { image_game_cover_idToimage: { as: "image" } } }
Merlin G
11/19/2021, 1:54 PMgetServerSideProps
we get an error when next build
is run with `target: serverless`:
Error: ENOENT: no such file or directory, open '/home/runner/work/<my path>/.next/serverless/chunks/schema.prisma
Has anyone seen anything like this? It seems particularly tricky to debug given that it only happens when prisma client calls are added to getServerSideProps
Sergey
11/19/2021, 3:58 PMtimothykrell
11/19/2021, 6:13 PMscore
field. I want to sort the model by the average of the two score
fields on its relations. Is this possible with Prisma client, or do I have to do a raw sql?Avi Fatal
11/19/2021, 9:20 PM> nx run auth:serve
chunk (runtime: main) main.js (main) 1.71 MiB [entry] [rendered]
WARNING in ./node_modules/@prisma/client/runtime/index.js 14988:18-45
Module not found: Error: Can't resolve 'encoding' in '/work/tokenct/apps/auth/node_modules/@prisma/client/runtime'
ERROR in ./node_modules/@prisma/client/runtime/index.js 27212:17-40
Module not found: Error: Can't resolve '_http_common' in '/work/tokenct/apps/auth/node_modules/@prisma/client/runtime'
webpack compiled with 1 error and 1 warning (e96b0171bcc71130)
There was an error with the build. See above.
/work/tokenct/dist/apps/auth/main.js was not restarted.
The webpack thing did not help...
I have downgraded from 16 because of this issue.
Anyone can help?
ThanksAhmet
11/20/2021, 12:17 AMIt should be understood as the set of changes to get from the expected schema to the actual schema.
[-] Removed tables
- Message
`[*] Changed the Message
table`
[-] Removed foreign key on columns (instanceWorkerId)
✔ We need to reset the PostgreSQL database "wmd_db" at "host:port".
Do you want to continue? All data will be lost. … no
I accidentally deleted the Message table in the prod environment. I’m worried about migrating. I know that if I say yes, my data will be lost. What should I do? I couldn’t find enough information in the documentation 😞