[codex] add local google watch tunnel support#1672
Merged
Conversation
…/add-gcal-webhook-tunnel # Conflicts: # docs/development/local-development.md # docs/self-hosting.md # packages/backend/.env.local.example # packages/backend/src/common/constants/env.constants.test.ts # packages/backend/src/common/constants/env.constants.ts # packages/backend/src/common/middleware/supertokens.middleware.ts # packages/backend/src/common/services/gcal/gcal.service.ts # packages/backend/src/servers/express/express.server.ts # packages/backend/src/sync/services/sync.service.test.ts # packages/backend/src/sync/services/sync.service.ts # packages/backend/src/sync/util/sync.util.ts # packages/web/build.ts # packages/web/dev.ts # packages/web/src/auth/google/hooks/useIsGoogleAvailable/useIsGoogleAvailable.ts # packages/web/src/views/CmdPalette/CmdPalette.tsx # packages/web/src/views/Day/components/DayCmdPalette.tsx # packages/web/src/views/Now/components/NowCmdPalette.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for testing Google Calendar Watch webhooks from a local Compass backend without forcing the whole app to use a public tunnel.
Before this change, Google Watch callbacks were tied to
BASEURL. That worked for production, but it made local end-to-end webhook testing awkward: settingBASEURLto a public HTTPS tunnel also pushed browser API calls and Server-Sent Events through that tunnel. With this change, Compass can keep normal app traffic on localhost while giving Google a separate public HTTPS callback URL.What Changed
Local Google Watch tunnel support
GCAL_WEBHOOK_BASEURL.GCAL_WEBHOOK_BASEURLwhen it is set.GCAL_WEBHOOK_BASEURLis not set, Compass falls back to the existingBASEURLbehavior.http://localhost:3000/apiwhile exposing only Google webhook callbacks through a temporary HTTPS tunnel such as Cloudflare Tunnel.Safer Google webhook validation
GCAL_WEBHOOK_BASEURL, when provided, is HTTPS.TOKEN_GCAL_NOTIFICATIONso webhook notifications can be validated.BASEURL.Watch creation and callback routing
BASEURL.Google connection health behavior
Config endpoint cleanup
/api/configinto a dedicated config route/controller instead of defining it inline in the Express server setup.Documentation and local setup guidance
.env.local.examplewithGCAL_WEBHOOK_BASEURLguidance and warnings about keeping normal app traffic on localhost.BASEURLand when local development should use the separate webhook URL.Changelog Notes
GCAL_WEBHOOK_BASEURLto a temporary public HTTPS tunnel while leavingBASEURLpointed at localhost.Test Plan
bun run test:backend -- env.constantsbun run test:backend -- gcal.servicebun run test:backend -- sync.servicebun run test:backend -- user-metadata.servicebun run test:backendbun run lint