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

[Feature Request]: Expose more powerful options for configuring network requests #272

Open
max-stytch opened this issue Oct 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@max-stytch
Copy link
Collaborator

max-stytch commented Oct 18, 2023

This is a tracking ticket to determine usecases & possible solutions where we want to allow callers greater control over configuring network requests.

Usecases

U1: NextJS Fetch Integration

NextJS 13's monkeypatching of fetch allows applications to control caching at a low level. As of #271 we disable this fetch caching, since it is not applicable to a large # of our endpoints (anything that starts a login transaction, or completes one). However, it may be applicable to endpoints like GET /users/:userID.

This fetch behavior is controlled by passing in custom options to fetch.

[Update Oct 19] However, we can't target only the NextJS runtime behavior. The NextJS fetch behavior is incompatible with Cloudflare Workers behavior, which doesn't allow the cache key to be set at all! See #273

U2: Observability Integrations

Are there integrations with o11y tools like opentelemetry that we'd like to better support, or fail to play nicely? Let's track them here.

Possible Solutions

S1: Take in arbitrary fetch options per request

This would be fairly low lift, solve for U1 but probably not U2.

S2: Take in arbitrary fetch options at client construction time

This would be very low lift, but is unlikely to solve for U1, since cache considerations, timing, and invalidation are likely to be very different between different API endpoints. The same cache policy applied to Members should not apply to Organizations, for example.

S3: Allow caller to pass in custom fetcher implementation

This would be a medium lift, and would provide the most robust solution for power users. However, it means that our API is significantly more complex, and we're pushing that complexity onto our users instead of managing it ourselves.

@max-stytch max-stytch added the enhancement New feature or request label Oct 18, 2023
@max-stytch max-stytch pinned this issue Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant