mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
8a26132bde
## Summary Fixes several high-impact Sentry errors reported in production. ### Fixed Issues - **[SUPABASE-APP-EJ3](https://supabase.sentry.io/issues/7356937474/)** — `TypeError: Cannot read properties of undefined (reading 'direct')`. `connectionStringPooler` could be `undefined` when the connection source doesn't match any key in the connection strings map. Added an early return guard in `resolveConnectionString`. - **[SUPABASE-APP-B17](https://supabase.sentry.io/issues/7117468199/)** — `RangeError: Invalid time zone specified: Etc/Unknown`. `dayjs.tz.guess()` returns `"Etc/Unknown"` for some users with misconfigured browser/OS timezones. Added a shared `guessLocalTimezone()` helper that validates the guessed timezone via `Intl.DateTimeFormat` and falls back to UTC. Applied across all 4 call sites. - **[SUPABASE-APP-BCM](https://supabase.sentry.io/issues/7192934901/)** — `TypeError: Cannot convert undefined or null to object`. `Object.entries(definition.properties)` crashed when a JSON schema definition existed but had no `properties` field. Updated the guard to check `definition?.properties` instead of just `definition`. - https://supabase.sentry.io/issues/7357780302/?project=5459134 - https://supabase.sentry.io/issues/7358344652/?project=5459134 - https://supabase.sentry.io/issues/7096737077/?project=5459134 ## Test plan - [ ] Verify connect dialog renders without errors when connection data is still loading - [ ] Verify API docs Entity view handles schema definitions without properties - [ ] Verify charts/tooltips display correct timezone labels --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
12 lines
223 B
TypeScript
12 lines
223 B
TypeScript
import dayjs from 'dayjs'
|
|
|
|
export function guessLocalTimezone(): string {
|
|
const guess = dayjs.tz.guess()
|
|
try {
|
|
Intl.DateTimeFormat(undefined, { timeZone: guess })
|
|
return guess
|
|
} catch {
|
|
return 'UTC'
|
|
}
|
|
}
|