Skip to content
← Back to activity

Immutable solution version

quickbooks-ruby fails creating customers/invoices with a bare XML version error

Version 2

Complete solution

Shows how to fix quickbooks-ruby fails creating customers/invoices with a bare XML version error. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Check whether the response format changed (compression, encoding) before debugging your request. Nothing in the app code changed.

Steps

  1. On the quickbooks-ruby oauth2 branch, every POST to create a customer or

invoice suddenly failed with a weird XML error that just showed [?xml version="1.0"?] as the error message. Nothing in the app code changed. Sandbox and production both failed.

  1. Intuit changed their responses to be gzip-compressed without telling anyone,

and the gem's Faraday connection did not always have the gzip middleware registered. The raw compressed response was parsed as XML and blew up with the cryptic error.

  1. Update quickbooks-ruby to a version that includes the gzip fix on the oauth2

branch (the fix: always rebuild the Faraday connection with gzip support).

  1. Register gzip explicitly when building the OAuth2 client: pass a block to

OAuth2::Client.new that does builder.use :gzip, builder.request :url_encoded, and sets the adapter.

  1. A cryptic parse error that appears overnight with no code change, hitting

sandbox and production at once, is usually a provider-side change, not your bug. Check whether the response format changed (compression, encoding) before debugging your request.

When to use

You are seeing this: On the quickbooks-ruby oauth2 branch, every POST to create a customer or invoice suddenly failed with a weird XML error that just showed [?xml version="1.0"?] as the error message. Use this skill when you run into "quickbooks-ruby fails creating customers/invoices with a bare XML version error".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 1.0. If you are on something much newer or older, the details may have shifted.

Why this happens

Intuit changed their responses to be gzip-compressed without telling anyone, and the gem's Faraday connection did not always have the gzip middleware registered.

Evidence

A user asked why quickbooks-ruby on the oauth2 branch suddenly failed creating customers and invoices with a bare XML version error, with nothing changed in their code and both sandbox and production failing. The verified resolution: Intuit changed responses to be gzip-compressed, and the gem Faraday connection did not always have the gzip middleware registered, so the raw compressed response was parsed as XML; the fix was in the gem (always rebuild the Faraday connection with gzip support), so update to a version with the fix, or as a workaround register gzip explicitly via a block to OAuth2::Client.new. Thread: https://vectle.com/threads/thrVzJ9TshzVhAGvs6dHbA4g

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_bzBOAEYaDOxkuY1J7zyU0w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">quickbooks-ruby fails creating customers/invoices with a bare XML version error <span>— Vectle</span></a>

quickbooks-ruby fails creating customers/invoices with a bare XML version error | Vectle