The identity ID returned by the webhook is all 0's...
# talk-kratos
e
The identity ID returned by the webhook is all 0's, using ory v0.13.0 Getting these values from context in the webhook endpoint
Copy code
{
  ctx: {
    flow: {
      expires_at: '2023-06-18T08:16:14.30789Z',
      id: '09f54558-a6a6-4904-89b5-f340fc396613',
      issued_at: '2023-06-18T08:06:14.30789Z',
      oauth2_login_challenge: null,
      request_url: '<http://192.168.29.24:3433/self-service/registration/api>',
      transient_payload: {},
      type: 'api',
      ui: [Object]
    },
    identity: {
      created_at: '0001-01-01T00:00:00Z',
      id: '00000000-0000-0000-0000-000000000000',
      metadata_public: null,
      recovery_addresses: [Array],
      schema_id: 'default',
      schema_url: '',
      state: 'active',
      state_changed_at: '2023-06-18T08:06:36.007784519Z',
      traits: [Object],
      updated_at: '0001-01-01T00:00:00Z',
      verifiable_addresses: [Array]
    },
    request_cookies: {},
    request_headers: {
      Accept: [Array],
      'Accept-Encoding': [Array],
      Connection: [Array],
      'Content-Length': [Array],
      'Content-Type': [Array],
      'User-Agent': [Array]
    },
    request_method: 'POST',
    request_url: '<http://192.168.29.24:3433/self-service/registration?flow=09f54558-a6a6-4904-89b5-f340fc396613>'
  },
  email: '<mailto:test2@test.com|test2@test.com>',
  id: '00000000-0000-0000-0000-000000000000'
}
this is the webhook code
Copy code
- 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>pbCwKIGlkOiBjdHguaWRlbnRpdHkuaWQsCiBjdHg6IGN0eAp9
                response:
                  parse: true
#kratos
f
@echoing-postman-28418 is this a “before” or “after” hook? Is it possible that the identity hasn’t been created yet?
e
it is an "after" hook
f
I think as it is a “parse” webhook and it modifies the identity, the identity is committed to the database only after the webhook responds with a 200, so it can use the response to modify the identity and only then it commits the identity to the database. So my guess is that the identity is still not created at this point, that’s why the “created at” field has zero value as well
e
Ohh got the issue, i wanted the flow to wait for the webhook, what i need to do is not set parse as true, but ignore as false
let me try this