ChilliCream / ChilliCream/graphql-platform
Recommended way to handle a disposed HttpClient inside Strawberry Shake's ConfigureHttpClient
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Product
Strawberry Shake
Version
16.6.1
Link to minimal reproduction
Just the basic code in https://chillicream.com/docs/strawberryshake/networking/authentication
Steps to reproduce
Any GraphQL Server and a client using Strawberry Shake working fine in normal circumstances
Now start the client when the GraphQL server is switched off. In my case I have Microsoft.Extensions.Http.Resilience from Aspire's ServiceDefaults active with Polly. After three failed attempts the debugger will complain about HttpClient being disposed at ConfigureHttpClient'a client.BaseAdress statement and your program terminates.
What is expected?
That the HttpClient you receive inside ConfigureHttpClient is a non-disposed instance
What is actually happening?
The HttpClient is disposed and your program terminates
Relevant log output
Additional context
It is non-documented behavior which impacts stability of applications that rely on Strawberry Shake
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Strawberry Shake authentication documentation and its basic client setup, then reproduce the failure with the GraphQL server switched off and Microsoft.Extensions.Http.Resilience with Polly enabled. Trace the HttpClient lifecycle around ConfigureHttpClient and the BaseAddress assignment across the three failed attempts. Done means ConfigureHttpClient receives a usable, non-disposed HttpClient and the client does not terminate after retries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100