[go: nahoru, domu]

Skip to content
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

Issue with generating the resolvers in outputs #454

Open
dharmendraboddeda opened this issue Jun 6, 2024 · 6 comments
Open

Issue with generating the resolvers in outputs #454

dharmendraboddeda opened this issue Jun 6, 2024 · 6 comments
Labels
question Further information is requested

Comments

@dharmendraboddeda
Copy link

Incorectly generating the rosolvers
i have used this same prisma schema at typegraphql-prisma version (0.27.1) but now when use current version 0.27.2 , i am facing the issue generating the resolvers.

generator typegraphql {
  provider           = "typegraphql-prisma"
  output             = "../generated/type-graphql"
  emitTranspiledCode = false
}

To Reproduce
2024-06-06-171042_screenshot

its generating this path

api/generated/type-graphql/resolvers/outputs/CreateManyChatsAndReturnOutputType.ts

and in this return outputType files this kind of modules are not resolving

import { Folder } from "../outputs/Folder";

but previous version that i have used i didn't get generate this files please resolve my issue

Expected Behavior
2024-06-06-171118_screenshot

See i have used typegraphql-prisma: "0.27.1"

Logs

    at _buildSchemaBin (file:///home/dharmendraboddeda/Projects/promanager/conversation-explorer-new/node_modules/@multiplatform.one/typegraphql/lib/chunk-SNLZTJW7.mjs:22:41) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///home/dharmendraboddeda/Projects/promanager/conversation-explorer-new/api/dist/api/main.mjs'
}

Node.js v20.12.1
node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module '/home/dharmendraboddeda/Projects/promanager/conversation-explorer-new/api/dist/api/main.mjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.12.1
Could not resolve "../outputs/Folder" from "generated/type-graphql/resolvers/outputs/CreateManyChatsAndReturnOutputType.ts"
file: /home/dharmendraboddeda/Projects/promanager/conversation-explorer-new/api/generated/type-graphql/resolvers/outputs/CreateManyChatsAndReturnOutputType.ts

Environment (please complete the following information):

  • OS: debian
  • Node : 20.12.1
  • typegraphql-prisma version [0.27.2]
  • Prisma version [5.8.1]
  • TypeScript version (5.3.3)
@MichalLytek
Copy link
Owner

Duplicate of #450?

@MichalLytek MichalLytek added the question Further information is requested label Jun 6, 2024
@Romanchuk
Copy link
Romanchuk commented Jun 10, 2024

I have the same issue

@savager
Copy link
savager commented Jun 11, 2024

CreateMany files are improperly importing the models it seems:

image

Maybe should be:

image

@vnamana
Copy link
vnamana commented Jun 13, 2024

image
I faced same issue and above change solves the issue, at least runtime error is not showing up after this fix.. this needs to be fixed in code where these imports are autogenerated at package level so that when running 'npm install' generates files with this fix when using below code in schema.prisma file:

generator typegraphql {
  provider           = "typegraphql-prisma"
}

@RubenNL
Copy link
RubenNL commented Jun 20, 2024

With the findings of the earlier comments, I added this after my prisma generate step:

find path-of-typegraphql-output/resolvers/outputs -type f -name 'CreateMany*' -exec sed -i 's/\.\.\/outputs\//\.\.\/\.\.\/models\//g' {} \;

Replace path-of-typegraphql-output with the default ./node_modules/@generated/type-graphql, or the output option configured in your prisma schema.

This does the same as what @savager found here: #454 (comment)

All of my old queries are working, but as I have a read-only database, I can't test the createMany.

@the-simian
Copy link

Adding this to the package.json seems to be a temporary workaround

"overrides": {
  "@prisma/generator-helper": "^5.4.2 <=5.13.0",
  "@prisma/internals": "^5.4.2 <=5.13.0"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants