We are using expo-server-sdk 0.1.6 together with http 5.3.1 in a Rails / Sidekiq production setup.
We hit an intermittent failure while sending push notifications:
HTTP::Error: Unknown MIME type: text/plain
Did you ever see this before?
The exception appears to come from the response parsing path inside the gem, specifically where response.parse is called in lib/push/client.rb.
From what we can see, the problem is not necessarily the push request itself, but the response parsing step:
- the notification may already have been accepted by Expo
- but if the upstream response has
Content-Type: text/plain, the http gem raises before the raw response can be inspected
- as a result, applications cannot see the actual response status, headers, or body
This makes production debugging difficult, especially for transient upstream/proxy/CDN issues.
Expected behavior:
- either handle unexpected content types more gracefully
- or raise a gem-specific error that includes access to the raw HTTP response
- or allow callers to inspect
status, headers, and body before JSON parsing happens
Suggested improvement:
- rescue
HTTP::Error around response.parse
- include response metadata in the raised error if possible
- optionally fall back to reading
response.to_s and raising a more descriptive Expo::Push::ServerError
A minimal improvement would already be very helpful:
- expose the response status
- expose the
Content-Type
- expose the raw body snippet
That would let applications distinguish between:
- actual Expo API errors
- transient proxy/CDN/network issues
- malformed or unexpected upstream responses
I would be very happy to collaborate on this, and I am available for any follow-up questions at any time and can respond quickly on short notice.
We are using
expo-server-sdk0.1.6together withhttp5.3.1in a Rails / Sidekiq production setup.We hit an intermittent failure while sending push notifications:
Did you ever see this before?
The exception appears to come from the response parsing path inside the gem, specifically where
response.parseis called inlib/push/client.rb.From what we can see, the problem is not necessarily the push request itself, but the response parsing step:
Content-Type: text/plain, thehttpgem raises before the raw response can be inspectedThis makes production debugging difficult, especially for transient upstream/proxy/CDN issues.
Expected behavior:
status,headers, andbodybefore JSON parsing happensSuggested improvement:
HTTP::Erroraroundresponse.parseresponse.to_sand raising a more descriptiveExpo::Push::ServerErrorA minimal improvement would already be very helpful:
Content-TypeThat would let applications distinguish between:
I would be very happy to collaborate on this, and I am available for any follow-up questions at any time and can respond quickly on short notice.