-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Prisma Client is not working #79
Comments
Hi @brandoncollins7, how are you accessing the database are you using |
I cannot reproduce it atm. Please provide a reproduction repo. |
Hi @marcjulian, I'm having the same issue but with a PNPM and Turborepo monorepo. I am using I have tried both exporting the custom output to node_modules as specified on the documentation as well as on a folder inside my src directory, but it seems that
app.module.ts
I can help providing a small repo to reproduce, but that will take a bit of time. Maybe this can help in the meantime? 😄 |
Thanks for the error logs. Looks like |
It looks like that this is caused because of the I guess the import need to change e.g. - import { CustomPrismaModule } from 'nestjs-prisma';
+ import { CustomPrismaModule } from 'nestjs-prisma/custom'; Lines 1 to 4 in a84e24d
A current workaround would be to change the imports too import { CustomPrismaModule } from 'nestjs-prisma/dist/custom';
import { CustomPrismaService } from 'nestjs-prisma/dist/custom'; |
Hi, thanks for the workaround, but it's seem we can't use the PrismaClientExceptionFilter with this (as it's also require prisma/client) Do you think it will be possible in the near future to use all the feature with a custom client ? or is there also another workaround for this case ? |
Incorrect temptation to import the default client instead of utilizing the provided custom client. **This solution is temporary!** Until nestjs-prisma new release. Related Links to the issue: - notiz-dev/nestjs-prisma#79
I am facing the same issue, I managed to solve this issue with workaround (thanks to @marcjulian), although I am not sure whether this is a stable or temporary solution. My stack:
|
@Krr0ptioN Could you share / show how you did your workaround ? |
@Valetek have you tried this workaround? #79 (comment) I think @Krr0ptioN means that workaround. |
HO yes this one, finally I used the setup for custom config (with prisma module) and everything is working fine, except that I used my own custom FilterException I did tried this workaround but it's still fail when calling the prismaFilterException |
Yes |
This is currently a temporary solution. When I have the time I would like to move all exports related to custom prisma service under |
* feat: setup prisma and database * add: createdAt and updateAt for collections * feat(dev): swagger, cors, hemlet, config * fix(prisma): custom prisma client * fix: PrismaCustomClient injection * fix: versioning correction * feat(module/music): CRUD with basic api documentation * feat: utils for logging * fix: api URI naming * fix(db/music): optional attribute * add(config): default storage directory for music upload destinationn * add(utils): audio file filteration for upload validation * add(utils): music file generator * feat(db): unique filename for uploaded music file * add(package): mutler and express for file upload * feat(module/music): music file upload while creating music * chore: changing prisma output directory * chore: prisma library import path for new client output directory Related commits: - 472612f * add: necessary packages for file upload * chore: ignore prisma client generation * fix(db|tmp): CustomPrismaClient issue Incorrect temptation to import the default client instead of utilizing the provided custom client. **This solution is temporary!** Until nestjs-prisma new release. Related Links to the issue: - notiz-dev/nestjs-prisma#79 * fix(module/music): invalid request - No file is provided * fix(module/music): create upload folder if it doesn't exist in the current container system * fix(module/music): file filteration and standard response * fix(module/music): parse the complex query request * refactor(module/music): query input validation and parsing * fix(module/music): using same file name - The controller create another filename instead of reusing what mutler provided * feat(module/music): stream music file * test(e2e): music creation * fix(test): api hello world * fix(test): server config * chore: add form data * chore: clean up * refactor(module/music): clean response and debug message * refactor(test): music creation - Utils for file stream creation - Central mock data collection - Renamed test * refactor(module/music): e2e * refactor(module/music): e2e * refactor(api): use supertest for e2e
* feat: music player widget * chore: correct naming convetion * chore: clean up * feat(ui): music player pause and play * feat(ui): design system & colorscheme * chore: clean up * feat(ui): music player * feat: setup prisma and database * add: createdAt and updateAt for collections * feat(dev): swagger, cors, hemlet, config * fix(prisma): custom prisma client * fix: PrismaCustomClient injection * fix: versioning correction * chore: lint * chore: lint * feat(module/music): CRUD with basic api documentation * feat: utils for logging * fix: api URI naming * fix(db/music): optional attribute * add(config): default storage directory for music upload destinationn * add(utils): audio file filteration for upload validation * add(utils): music file generator * feat(db): unique filename for uploaded music file * add(package): mutler and express for file upload * feat(module/music): music file upload while creating music * chore: changing prisma output directory * chore: prisma library import path for new client output directory Related commits: - 472612f * add: necessary packages for file upload * chore: ignore prisma client generation * chore: lint & cleanup * fix(db|tmp): CustomPrismaClient issue Incorrect temptation to import the default client instead of utilizing the provided custom client. **This solution is temporary!** Until nestjs-prisma new release. Related Links to the issue: - notiz-dev/nestjs-prisma#79 * fix(module/music): invalid request - No file is provided * fix(module/music): create upload folder if it doesn't exist in the current container system * fix(module/music): file filteration and standard response * fix(module/music): parse the complex query request * refactor(module/music): query input validation and parsing * fix(module/music): using same file name - The controller create another filename instead of reusing what mutler provided * feat(module/music): stream music file * test(e2e): music creation * fix(test): api hello world * fix(test): server config * chore: lint * chore: add form data * chore: clean up * refactor(module/music): clean response and debug message * refactor(test): music creation - Utils for file stream creation - Central mock data collection - Renamed test * chore: gitignore update * feat: utils for api request in frontend * feat: music type for store and api * feat(music-player): action hook * feat(music-player): redux store for music player * feat(music-player): refactor the complicated div design to slider * feat(music-player): next and previous button * feat(music-player): redux store instead of state * feat(music-player): next and previous redux action creator * refactor(module/music): e2e * refactor(module/music): e2e * refactor(api): use supertest for e2e * lint * add: docker compose
I just ran into this problem and the workaround still seems valid, although the path has changed slightly: import { CustomPrismaModule } from 'nestjs-prisma/dist/custom'; |
I am using an nx mono repo and I have my prisma models dumping to a library. So I am trying to integrate this by using a custom prisma client:
`import {PrismaClient} from '@frnt/lending-api/models'
@global()
@module({
imports: [
CustomPrismaModule.forRoot({
name: 'PrismaService',
client: new PrismaClient()
}),`
But it just seems like it is not working at all because when I run it is looking for the prisma client in node_modules?
`Error: Cannot find module '.prisma/client/index'
Require stack:
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Function.Module._load (node:internal/modules/cjs/loader:920:27)
at Function.Module._load (node_modules@nx\js\src\executors\node\node-with-require-overrides.js:18:31)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (node_modules@[email protected][email protected]\node_modules@prisma\client\index.js:2:6)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Function.Module._load (node_modules@nx\js\src\executors\node\node-with-require-overrides.js:18:31)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object. (node_modules\nestjs-prisma\lib\prisma.service.ts:9:1)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
`
The text was updated successfully, but these errors were encountered: