Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Events not register correct #4

@Cristiano1103

Description

@Cristiano1103

No handler found for event type: customer.subscription.updated on First Attempt

📝 Description

When the AdonisJS server starts, the first time a Stripe webhook event (e.g., customer.subscription.updated) is sent, the system logs: No handler found for event type: customer.subscription.updated

However, on the second attempt, the event is handled correctly. This suggests that event handlers are not being registered at the right moment during the server initialization.


⚡ Steps to Reproduce

  1. Start the AdonisJS server.
  2. Send a Stripe event (e.g., using stripe trigger customer.subscription.updated).
  3. The first request logs: No handler found for event type: customer.subscription.updated
  4. Send the same event again, and now it works as expected.

✅ Expected Behavior

  • The event handlers should be available immediately after the server starts.
  • The first event from Stripe should be processed correctly, just like subsequent ones.

🚨 Current Workaround

A temporary fix was to register event listeners in the ready() method inside a custom provider:

export default class StripeProvider {
constructor(protected app: ApplicationService) {}

async ready() {
 new PaymentService(new StripePaymentRepository())
}
}

However, this seems like a hack rather than the proper solution. Ideally, event handlers should be available as soon as the server starts.

🛠 Possible Cause

The issue may be related to the order in which services are initialized in AdonisJS 6.
If the Stripe service is not fully ready when the app starts, the event handlers might not be registered properly until after the first webhook attempt.


💡 Suggested Fix

  • Ensure that event handlers are registered as soon as the server starts (not on first use).
  • Maybe expose a ready() method in @vbusatta/adonis-stripe to allow proper event registration timing.

📌 Environment

  • AdonisJS Version: 6.x
  • Node.js Version: (v22.6.0)
  • Stripe Package: @vbusatta/adonis-stripe (latest version)
  • Database: PostgreSQL

🔎 Additional Notes

Would be great if someone could confirm if this is a known issue or if there's a better way to register event handlers on server boot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions