@calcom/[email protected] fails at runtime in a minimal Next.js App Router project when rendering the Booker atom from a client-only modal.
The same repro works on @calcom/[email protected]. The only intended difference between the working and failing branches is the package version and resulting lockfile changes.
Repro repo: https://github.com/mogusbi-motech/cal-com-atom-bundling-issue
Failing branch using @calcom/[email protected]:
https://github.com/mogusbi-motech/cal-com-atom-bundling-issue/tree/main
Working comparison branch using @calcom/[email protected]:
https://github.com/mogusbi-motech/cal-com-atom-bundling-issue/tree/working-2.6.0
The current failure appears to come from @calcom/atoms/dist/vendor/timezone-constants.js, which evaluates dayjs.tz.guess() before dayjs.tz is available.
Clone the repro:
git clone https://github.com/mogusbi-motech/cal-com-atom-bundling-issue.git
cd cal-com-atom-bundling-issue
Check out the failing branch:
git checkout main
Install dependencies:
pnpm install
Start the app:
pnpm dev
Open the local Next.js URL.
Submit the form with valid Cal.com values:
https://api.cal.com/v2Click Open calendar modal.
For comparison, the same flow works on:
git checkout working-2.6.0
pnpm install
pnpm dev
@calcom/[email protected].Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'guess')
Call Stack
eval
node_modules/@calcom/atoms/dist/vendor/timezone-constants.js (4:21)
Before reaching this error, 2.11.0 also required adding Stripe packages because the top-level Atoms import pulls in payment modules:
Module not found: Can't resolve '@stripe/react-stripe-js'
Installing the Stripe dependencies resolves that module-resolution error, but the timezone runtime error remains.
CalProvider and Booker from @calcom/atoms should render the Booker atom successfully.mainworking-2.6.0@calcom/[email protected]@calcom/[email protected]14.2.3518.3.1v24.14.111.1.0During incremental upgrade testing, these version ranges showed different failures:
| Version range | Observation |
|---|---|
2.6.0 | Works. |
2.7.0 to 2.8.2 | Router/search-params runtime issue in the Booker path, with a failure like Cannot read properties of null (reading 'get'). |
2.8.3 to 2.8.9 | Runtime failure from react-use/lib/usePrevious: TypeError: react_use_lib_usePrevious__WEBPACK_IMPORTED_MODULE_3__ is not a function. |
2.9.0 to 2.11.0 | Runtime failure from dist/vendor/timezone-constants.js: Cannot read properties of undefined (reading 'guess'). |
The repro contains two branches that should make the difference easy to verify:
main: fails with @calcom/[email protected]working-2.6.0: works with @calcom/[email protected]The README contains the same reproduction notes: https://github.com/mogusbi-motech/cal-com-atom-bundling-issue/blob/main/README.md