Skip to content

docs: clarify async and callback plugin styles#297

Closed
MauricioMoraisZage wants to merge 1 commit into
fastify:mainfrom
MauricioMoraisZage:docs/clarify-async-callback-plugin-style
Closed

docs: clarify async and callback plugin styles#297
MauricioMoraisZage wants to merge 1 commit into
fastify:mainfrom
MauricioMoraisZage:docs/clarify-async-callback-plugin-style

Conversation

@MauricioMoraisZage

Copy link
Copy Markdown

Summary

Clarifies that plugin functions should not mix callback and async styles.

This adds a short documentation note explaining that async plugin functions should not use the done callback, and shows separate examples for callback-style and async-style plugins.

Related issue

Refs: #221

@Fdawgs Fdawgs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MauricioMoraisZage

Copy link
Copy Markdown
Author

Already covered by Fastify's docs: https://fastify.dev/docs/latest/Reference/Hooks/?_highlight=mix#respond-to-a-request-from-a-hook

Thanks for the review.

I understand that this behavior is already covered in the Fastify documentation. Would it be useful to replace this section with a short cross-reference to the existing Fastify docs, or would you prefer me to close this PR?

@Tony133 Tony133 requested a review from Fdawgs July 13, 2026 08:00
@Fdawgs

Fdawgs commented Jul 14, 2026

Copy link
Copy Markdown
Member

Not needed at all, as the FST_ERR_PLUGIN_INVALID_ASYNC_HANDLER will be thrown. See https://fastify.dev/docs/latest/Reference/Errors/?_highlight=mix#fastify-error-codes.

The mentioned issue pre-dates the error code mentioned.

Thanks though.

@Fdawgs Fdawgs closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants