Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We generate the prisma client as part of redwood build - as is standard for redwood projects. However, we then ship this in the dist to end users. The prisma client is platform/architecture specific. This means, as an example, that the prisma client built for my M2 MacBook is not working for users that are running on amd64 ubuntu.
Changes
studio:package
step.Notes
You might consider this wasteful from a performance point of view. The client likely only needs to be generated once for the user as the underlying platform/arch isn't likely to change. For now, I think this is acceptable and can be made more performant in a future chore - this is intended to fix the bug that users are experiencing right now.
The server file had to be updated to make use of dynamic imports in place of static imports. This is because the prisma client does not exist when the server file is loaded - only after a certain point in the execution of the server file does the client get generated. As a result static imports and any level of nested static imports of the prisma client will throw an error. Dynamically importing the functions that access the DB in this one file seems like an okay compromise.