echoing-postman-28418
03/22/2023, 8:36 AM{
"id": "b7593ca3-1bda-4ba2-93f6-c13490ed1a71",
"error": {
"code": 500,
"status": "Internal Server Error",
"message": "hook response could not be unmarshalled properly from JSON: invalid character 'S' looking for beginning of value"
},
"created_at": "2023-03-22T08:34:47.049429Z",
"updated_at": "2023-03-22T08:34:47.049429Z"
}
my webhooks config
registration:
lifespan: 10m
ui_url: <http://127.0.0.1:3000/registration>
after:
password:
hooks:
- hook: web_hook
config:
url: <http://host.docker.internal:4000/api/v1/web-hooks/ory-identities/check-user-in-invite>
method: POST
body: <base64://ZnVuY3Rpb24oY3R4KSB7CiBlbWFpbDogY3R4LmlkZW50aXR5LnRyYWl0cy5lbWF>pbCwKIGN0eDogY3R4Cn0=
can_interrupt: true
- hook: web_hook
config:
url: <http://host.docker.internal:4000/api/v1/web-hooks/ory-identities/generate-key-for-registered-user>
method: POST
body: <base64://ZnVuY3Rpb24oY3R4KSB7CiBlbWFpbDogY3R4LmlkZW50aXR5LnRyYWl0cy5lbWF>pbCwKIGN0eDogY3R4Cn0=
can_interrupt: true
- hook: session
this is how my api returns the error (ory reacts properly incase of error)
return res.status(404).json({
messages: [
{
instance_ptr: "#/traits/email",
messages: [
{
id: 123,
text: "Not found in waiting list",
type: "validation",
context: {
value: "not allowed",
},
},
],
},
],
});
this is how i return success (ory is unable to handle even when status code is 200)
return res.status(200).send("Success");
echoing-postman-28418
03/22/2023, 8:58 AMproud-plumber-24205
03/22/2023, 10:31 AM{
"message": "success"
}
On the latest commit of Kratos there is support for config.response.parse: false
https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#modify-identitiesechoing-postman-28418
03/22/2023, 10:31 AMproud-plumber-24205
03/22/2023, 10:32 AMproud-plumber-24205
03/22/2023, 10:32 AMproud-plumber-24205
03/22/2023, 10:32 AMechoing-postman-28418
03/22/2023, 10:32 AMechoing-postman-28418
03/22/2023, 10:32 AMechoing-postman-28418
03/22/2023, 10:32 AMproud-plumber-24205
03/22/2023, 10:33 AMthe thing is it shouldn't interrupt the flow if the request gives 200 status. but it still doesYes because the json marshalling is failing. This isn't returning valid json:
return res.status(200).send("Success");
Instead it should be:
return res.status(200).send({"message":"success"});
echoing-postman-28418
03/22/2023, 10:34 AMproud-plumber-24205
03/22/2023, 10:34 AMis it fixed in next release?Nothing needs to be fixed if valid json is returned. But if you want to prevent the webhook from parsing the response then you need the latest commit from master
echoing-postman-28418
03/22/2023, 10:34 AMechoing-postman-28418
03/22/2023, 10:34 AMproud-plumber-24205
03/22/2023, 10:36 AMechoing-postman-28418
03/22/2023, 10:36 AM