Title: Bug: supabaseIntegration crashes when PostgREST response is nullish · Issue #20032 · getsentry/sentry-javascript · GitHub
Open Graph Title: Bug: supabaseIntegration crashes when PostgREST response is nullish · Issue #20032 · getsentry/sentry-javascript
X Title: Bug: supabaseIntegration crashes when PostgREST response is nullish · Issue #20032 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/20032
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: supabaseIntegration crashes when PostgREST response is nullish","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n`@sentry/react-native` (via `@sentry/core` supabase integration re-exported by `@sentry/browser`)\n\n### SDK Version\n\n8.6.0\n\n### Framework Version\n\nReact Native\n\n### Link to Sentry event\n\n_SDK crash detection event — internal to Sentry_\n\n### Steps to Reproduce\n\n1. Use `supabaseIntegration` in a React Native app\n2. Perform a PostgREST query (e.g. `supabase.from('table').select('*')`)\n3. Under certain conditions (likely related to RN's `fetch` implementation or a custom `fetch` passed to the Supabase client), the PostgREST response resolves with `undefined` instead of the expected `{ data, error, status }` object\n\n### Expected Result\n\nThe integration should handle a nullish response gracefully without crashing.\n\n### Actual Result\n\nThe SDK crashes with an unhandled `Error` (empty message) at `instrumentPostgRESTFilterBuilder` in `supabase.ts`.\n\nThe crash occurs in the `.then()` success handler after `Reflect.apply(target, thisArg, [])`, where `res.error` is accessed without a null check on `res`:\n\nhttps://github.com/getsentry/sentry-javascript/blob/0ccab39ff4e498228ntonio/packages/core/src/integrations/supabase.ts#L342\n\n```typescript\n// Current code (crashes when res is nullish):\n(res: SupabaseResponse) => {\n if (res && typeof res === 'object' && 'status' in res) {\n setHttpStatus(span, res.status || 500);\n }\n span.end();\n\n if (res.error) { // 💥 TypeError if res is undefined\n```\n\nNotably, the auth instrumentation in the same file already guards against this correctly:\n\n```typescript\n// Auth path (safe):\nif (res && typeof res === 'object' && 'error' in res && res.error) {\n```\n\n### Additional Context\n\nThis was detected via Sentry's SDK crash detection (`sdk_crash_detection` context). The mechanism is `auto.db.supabase.postgres`, confirming it's the PostgREST path.\n\n**Why this appears to be React Native-specific:**\n\nPostgREST's `.then()` is a custom thenable that internally calls `fetch()`, processes the response in an `async` callback, and returns `internalPromise.then(onfulfilled, onrejected)`. When Sentry calls it with no arguments (`Reflect.apply(target, thisArg, [])`), both callbacks are `undefined`, so the resolved value should pass through per the Promise/A+ spec.\n\nHowever, React Native uses its own native-bridged `fetch` implementation (not the browser's), and users often provide a custom `fetch` to the Supabase client as recommended by Supabase docs. If the fetch resolves differently (e.g., on network errors or timeouts), the PostgREST async handler could exit without an explicit `return`, resolving with `undefined`.\n\n**Suggested fix:**\n\nGuard `res` before accessing `.error`, consistent with the auth handler:\n\n```typescript\nif (res && res.error) {\n```\n\nOr use optional chaining throughout the success handler.\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/antonis","@type":"Person","name":"antonis"},"datePublished":"2026-03-30T07:13:12Z","url":"https://github.com/getsentry/sentry-javascript/issues/20032"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9e7252b4-0054-e661-582a-742fbe50e592 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9B2:FD77C:F53583:13E91C7:6B04E87E |
| html-safe-nonce | b98031ca509b723c380b2df2d628ee545729825a3ab961bdb2480433f6382564 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUIyOkZENzdDOkY1MzU4MzoxM0U5MUM3OjZCMDRFODdFIiwidmlzaXRvcl9pZCI6Ijc3NzU0NDY0NTMzMDAwMjk1NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 587c87e9f2bf2d80eaa5b29ad9a2b68d39b2a042b727d0913e8a646a71f8b3ba |
| hovercard-subject-tag | issue:4168141467 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/20032/issue_layout |
| twitter:image | https://opengraph.githubassets.com/baa9aff1b86e724b6becfe7091d5537a635eb8a59a2442e0c4c8e3d2287dc7e7/getsentry/sentry-javascript/issues/20032 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/baa9aff1b86e724b6becfe7091d5537a635eb8a59a2442e0c4c8e3d2287dc7e7/getsentry/sentry-javascript/issues/20032 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | antonis |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width