Error Handling with ErrorPlugin #172
Replies: 4 comments 5 replies
-
I just saw that I need to put the error plugin before the prisma plugin, so I did that. But it's still giving me the same error. Updated builder:
|
Beta Was this translation helpful? Give feedback.
-
Can you update your plugins to the latest version? Looks like Prisma plugin
is using the old API. The latest version of the Prisma plugin was a major
rewrite, and the way the integration with other plugins worked was
updated. It's possible you have a new version of the errors plugin that
the old Prisma plugin doesn't know how to integrate with.
Not 100% sure this is the issue, but it's the most obvious thing I see.
…On Wed, Sep 15, 2021, 06:00 Ibrahim-Furkan Demirbilek < ***@***.***> wrote:
I just saw that I need to put the error plugin before the prisma plugin,
so I did that. But it's still giving me the same error.
Updated builder:
export const builder = new SchemaBuilder<{
...
}>({
defaultInputFieldRequiredness: true,
plugins: [
ErrorsPlugin,
SimpleObjectsPlugin,
ScopeAuthPlugin,
ValidationPlugin,
SmartSubscriptionsPlugin,
PrismaPlugin,
],
errorOptions: {
defaultTypes: [Error],
},
authScopes: async ({ user }) => ({
public: true,
user: !!user,
unauthenticated: !user,
}),
smartSubscriptions: {
...subscribeOptionsFromIterator((name, { pubsub }) => {
return pubsub.asyncIterator(name);
}),
},
prisma: { client: db },
});
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#172 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGHLD4HORMMFXLQRHOZONTUCCDEBANCNFSM5ECEGHSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I had to do some things and fixed everything in my backend now. It was indeed because of the old prisma plugin version! The solution was to keep your packages up to date! Thank you again for your help. |
Beta Was this translation helpful? Give feedback.
-
The whole point of the plugin is to make errors part of the normal
response, so this is expected behavior. GraphQL in general will always
return a 200 even if fields in the response throw errors. If you wanted to
change this it could probably be done with graphql helix and a custom http
handler that checked a response for errors before setting the status code.
…On Wed, Sep 15, 2021, 15:55 Ibrahim-Furkan Demirbilek < ***@***.***> wrote:
Sorry, I had to do some things and fixed everything in my backend now. It
was indeed because of the old prisma plugin version!
The only thing that's kind of weird now is, that the error gets
categorised as a response and not an error. But that's fine for now.
The solution was to keep your packages up to date!
Thank you again for your help.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#172 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGHLDYSZZNYWWJ22FVY2FDUCEI4PANCNFSM5ECEGHSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
Hey,
I am having trouble with implementing the error plugin into my project and wanted to ask what the error could be. I unfortunately couldn't solve it by myself. I am getting a response from my mutation that says:
My builder looks like this:
My error object & interface is the same as the one in the docs
My problem is either in my resolver here or in my mutation on the frontend I suppose.
So here is my resolver, it's just for sending friend requests:
and the frontend mutation looks like this (I am using relay for the frontend) :
the onSubmit for the form:
Thank you in advance and sorry to bother you guys with such a silly error 🙏
Beta Was this translation helpful? Give feedback.
All reactions