8000 Fix #265 by passing options to FirebaseAlertOptions by nathansamson · Pull Request #266 · firebase/firebase-functions-python · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/firebase_functions/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ def _endpoint(
return FirebaseAlertOptions(
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
Comment on lines 673 to +675
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The app_id is passed as an explicit keyword argument, but it will also be present in the dictionary returned by self._asdict_with_global_options() because AppDistributionOptions has an app_id field. This will result in a TypeError for passing app_id twice when self.app_id is not None.

Since _asdict_with_global_options() already includes app_id from self, you can remove the explicit app_id=self.app_id argument.

Suggested change
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
alert_type=kwargs["alert_type"],
**self._asdict_with_global_options()

)._endpoint(**kwargs)


Expand All @@ -695,6 +696,7 @@ def _endpoint(
return FirebaseAlertOptions(
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
Comment on lines 697 to +699
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The app_id is passed as an explicit keyword argument, but it will also be present in the dictionary returned by self._asdict_with_global_options() because PerformanceOptions has an app_id field. This will result in a TypeError for passing app_id twice when self.app_id is not None.

Since _asdict_with_global_options() already includes app_id from self, you can remove the explicit app_id=self.app_id argument.

Suggested change
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
alert_type=kwargs["alert_type"],
**self._asdict_with_global_options()

)._endpoint(**kwargs)


Expand All @@ -718,6 +720,7 @@ def _endpoint(
return FirebaseAlertOptions(
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
Comment on lines 721 to +723
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The app_id is passed as an explicit keyword argument, but it will also be present in the dictionary returned by self._asdict_with_global_options() because CrashlyticsOptions has an app_id field. This will result in a TypeError for passing app_id twice when self.app_id is not None.

Since _asdict_with_global_options() already includes app_id from self, you can remove the explicit app_id=self.app_id argument.

Suggested change
alert_type=kwargs["alert_type"],
app_id=self.app_id,
**self._asdict_with_global_options()
alert_type=kwargs["alert_type"],
**self._asdict_with_global_options()

)._endpoint(**kwargs)


Expand All @@ -735,6 +738,7 @@ def _endpoint(
assert kwargs["alert_type"] is not None
return FirebaseAlertOptions(
alert_type=kwargs["alert_type"],
**self._asdict_with_global_options()
)._endpoint(**kwargs)


Expand Down
0