-
Notifications
You must be signed in to change notification settings - Fork 201
fix(extension): create eventChannel after initializeApp #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR defers creation of the EventArc channel until after the Firebase Admin app is initialized by replacing the static eventChannel export with a getEventChannel() factory and updating all usages accordingly.
- Replace
eventChannelimport withgetEventChannel()inindex.tsandwebhook-events.ts - Update
config.tsto provide agetEventChannel()function instead of a static export - Adjust unit tests and environment setup to reflect renamed functions and variables
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| functions/src/index.ts | Import and invoke getEventChannel() after initializeApp() |
| functions/src/handlers/webhook-events.ts | Import and invoke getEventChannel() inside HTTP handler |
| functions/src/config.ts | Replace eventChannel constant with getEventChannel() |
| functions/tests/tests/unit/handlers/webhook-events.test.ts | Mock getEventChannel() instead of eventChannel |
| functions/tests/helpers/setupEnvironment.ts | Rename environment-path variables to consistent camelCase |
Files not reviewed (1)
- firestore-stripe-payments/functions/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
firestore-stripe-payments/functions/src/config.ts:55
- [nitpick] Add a JSDoc comment to
getEventChanneldescribing its return type (Channel | undefined) and when it returnsundefinedfor improved clarity.
export const getEventChannel = () => {
firestore-stripe-payments/functions/src/index.ts:21
- The default
configimport isn't used in this file—consider removing it to keep imports focused.
import config from './config';
| import Stripe from 'stripe'; | ||
| import * as logs from '../logs'; | ||
| import config, { eventChannel, stripe } from '../config'; | ||
| import config, { getEventChannel, stripe } from '../config'; |
Copilot
AI
Jul 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default config import appears unused here; you can remove it to reduce unnecessary imports.
| import config, { getEventChannel, stripe } from '../config'; | |
| import { getEventChannel, stripe, stripeWebhookSecret } from '../config'; |
| }, | ||
| }, | ||
| eventChannel: null, | ||
| getEventChannel: () => null, |
Copilot
AI
Jul 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real getEventChannel() returns undefined when EVENTARC_CHANNEL is not set; mock it to return undefined instead of null to better mirror production behavior.
| getEventChannel: () => null, | |
| getEventChannel: () => undefined, |
0b275ea to
3814699
Compare
ae317b2 to
dc0ee62
Compare
Should fix #699
TODO: