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

GraphQL Error: "message": "options.ctr is not a constructor" when using fieldEdge? #1782

Open
ashleyxue529 opened this issue Mar 2, 2024 · 1 comment

Comments

@ashleyxue529
Copy link

Setup is like this:

UserSchema:
...
 fields: {
    foodID: UUIDType({
      fieldEdge: { schema: "Food", inverseEdge: "users" },
    }),
...

FoodSchema:
...
edges: [
    {
      name: "users",
      schemaName: "User",
    },

Codegen is successful, but I think some files/naming is missing/incorrect? When running the query in GraphiQL, it produces the error "message": "options.ctr is not a constructor". I saw that in user_to_foods_connection_type.ts, UserToFoodsEdge is missing:

import { UserToFoodsEdge } from "src/ent/";

Am I missing something in my setup?

@lolopinto
Copy link
Owner

I'm not sure. this might be a weird pluralization thing

are you using v0.1.* or v0.2.*?

UserToFoodsEdge should be defined in src/ent/user/query/user_to_foods_query.ts based on your schema

are you using docker or running locally?

if you're using docker, can you run with --write-all

docker-compose -f docker-compose.dev.yml run --rm app tsent codegen --write-all

or locally:

tsent codegen --write-all

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

No branches or pull requests

2 participants