ChilliCream / ChilliCream/graphql-platform

Recommended way to handle a disposed HttpClient inside Strawberry Shake's ConfigureHttpClient

Open
#10,296 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.