Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting requestContext outside of a fastify route #211

Open
2 tasks done
Floriferous opened this issue Jan 23, 2025 · 2 comments · May be fixed by #213
Open
2 tasks done

Allow setting requestContext outside of a fastify route #211

Floriferous opened this issue Jan 23, 2025 · 2 comments · May be fixed by #213

Comments

@Floriferous
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

We're listening to webhooks on our fastify backend with GCP's pubsub, they offer a library that handles the routing of those webhooks, and is therefore not done via a fastify route. Some of these requests can be authenticated with the payload of the webook.

We're using this package to store the auth object and easily be able to retrieve it later.

It'd be great if it was possible to set the request context outside of a fastify handler, and let the rest of our application code still work as if it was called with a proper request context.

Right now, if I try to use requestContext.set from this webhook, it does not allow me to retrieve this data later on.

Motivation

No response

Example

No response

@kibertoad
Copy link
Member

PR would be welcome

@Floriferous
Copy link
Author

Similarly, when running tests, you'd want to be able to set the context before your test, and then have the rest of your code behave as intended.

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 a pull request may close this issue.

2 participants