-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Failed to load schema from scalar BigInt #4394
Comments
Don't know who's best suited for this. @dac09, I'll assign it to you. Feel free to pass it on if you want. The easy to way to work around my issue is to add an Ideally doing what I'm doing above should just work. But if that's not feasible, at least provide better messaging and/or docs around this. And even if our generators don't support this, there should be a way to get this working manually, imho. |
This issue here is that you're generating things in a strange order, no? It makes sense that the generators don't know what CategoryToProduct is if you've not generated an sdl for C2P first. I understand it being confusing, but I'm not sure what the expected behaviour would be? Message to say "do things in the right order please?" doesn't seem helpful to me. |
I agree. It's difficult to say what the expected behaviour should be here. And there are a few different things going on, and they all add to the confusion. The error message starts with
Reading that it sounds like the problem is with "scalar BigInt". And if you've mainly done frontend stuff you might not even know what that means. So the thought process might go something like "Ehh, ok, I don't really know what that means, but let's keep reading, see if I find something I recognise". And so you find this
And you're like "Ohh, it's complaining about types. Let's run the types generator" And so you run Something like that ☝️ is the experience for someone new to this. I want to make this experience better for our users. Another thing about this is even I don't know how to manually solve this. Where do I need to go and add the CategoryToProduct type? |
I am having the same issue and I have run the scaffold for all of the models and still have missing types. When I try to run |
@mbush92 Thanks for chiming in here! I've added this to our DX-improvement board and will make sure this gets some more love soon. https://github.com/orgs/redwoodjs/projects/9/views/1 |
@Tobbe any idea how to fix this manually so that I can generate the types? My schema.prisma file looks like this
I don't see anything that would make me think there would be an issue. |
@dthyresson Tagging you because I know you've been through this issue recently too. Please let us know if you found a better way to do this than what I'm about to describe. @mbush92 This is how I got your schema models scaffolded: 1. Comment out all relations
2. Scaffold all models
3. Uncomment one relation at a time
4. Scaffold
|
@Tobbe thanks! That worked. I have now been able to scaffold everything and get the backend working. |
I think this BigInt error is a by-product of the entire schema not loading properly due to the dependency on types. The main issue is: #4762 So, while the error happens -- it isn't a cause, but an effect Will test that can still use BigInts in a schema with a single table and also in some table with relations. |
Can do @nickpdemarco, but I'm not sure there's an obvious path to resolving this. We'd have to somehow detect the order of relations to generate, then step through that. My worry with this is the extra complexity it might introduce, but open to ideas. And extra complexity === more things that break |
@dac09 For my original problem, that I have in the issue description, no matter what order you generate stuff in, it won't work. Our generators simply can't handle this. @nickpdemarco Two questions for you. 1) There are a few different issues mentioned across the posts here. Could you please post a reproduction/description of the issue you're thinking of? 2) How would you like it to work?/What would you like our generators to do? |
I'm getting errors when trying to (re-) generate sdls, and when trying to generate types
Here's how to reproduce:
Replace the content in
schema.prisma
with this:So far everything works fine.
Now, un-comment everything in
schema.prisma
, and then migrate againNow try to generate sdl crud for product again and you'll see a bunch of errors.
Generating types as above also gives the same error message
The text was updated successfully, but these errors were encountered: