Skip to content

fix(functions): correct httpsCallable timeout units on macOS/web#9077

Merged
mikehardy merged 2 commits into
mainfrom
functions-timeout-other-fix
Jun 26, 2026
Merged

fix(functions): correct httpsCallable timeout units on macOS/web#9077
mikehardy merged 2 commits into
mainfrom
functions-timeout-other-fix

Conversation

@mikehardy

@mikehardy mikehardy commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

HttpsCallableOptions.timeout is documented in milliseconds, but namespaced.ts always divided by 1000 before calling the native/web layer. That conversion is correct for Android/iOS native (seconds), but wrong for isOther platforms (macOS, web) which route through the Firebase JS SDK and expect milliseconds. Custom timeouts on those platforms were effectively 1/1000th of the intended value (e.g. 30s → 30ms), causing spurious deadline-exceeded errors.

Related issues

None, found while attempting to mitigate functions e2e flakes in the drive to eliminate flakiness entirely

Lesson in general: the gap between 99% and 100% (or even 95% to 99%) is where you discover all sorts of things, even some long-standing bugs!

Release Summary

Fix httpsCallable / httpsCallableFromUrl timeout handling on macOS and other web-backed platforms.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android (unchanged; regression unit test)
    • iOS (unchanged; area e2e passed)
    • Other (macOS, web) — fix target
  • My change includes tests;
    • e2e tests added or updated in packages/**/e2e
    • jest tests added or updated in packages/**/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

  • yarn tests:jest packages/functions/__tests__/httpsCallable-timeout-other.test.ts packages/functions/__tests__/httpsCallable-timeout-native.test.ts
  • macOS focused: new e2e HttpsCallableOptions.timeout honors millisecond values on web/macos
  • macOS area (functions): 98 passing
  • iOS focused: modular sleeperV2 timeout test
  • iOS area: full suite green (functions included)

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where HttpsCallableOptions.timeout values were incorrectly converted from milliseconds to seconds on web and macOS platforms. By introducing a platform-aware check, the logic now correctly maintains millisecond precision for web-backed environments while preserving the existing seconds-based conversion for native Android and iOS platforms, preventing spurious deadline-exceeded errors.

Highlights

  • Timeout Unit Correction: Updated httpsCallable and httpsCallableFromUrl to prevent unnecessary division by 1000 on web and macOS platforms, ensuring timeout values remain in milliseconds as expected by the Firebase JS SDK.
  • Regression Testing: Added new Jest unit tests to verify correct timeout unit conversion behavior across both native (Android/iOS) and non-native (web/macOS) platforms.
  • E2E Validation: Included a new end-to-end test case to ensure HttpsCallableOptions.timeout is correctly honored on web and macOS environments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates httpsCallable and httpsCallableFromUrl to only convert the timeout option from milliseconds to seconds on native platforms (Android/iOS), leaving it in milliseconds on other platforms (web/macos). It also adds unit and E2E tests to verify this behavior. The review feedback points out that mutating the user-provided options object directly can cause unexpected side effects if the object is reused, and suggests creating a shallow copy instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/functions/lib/namespaced.ts Outdated
Comment thread packages/functions/lib/namespaced.ts Outdated
@mikehardy mikehardy force-pushed the functions-timeout-other-fix branch from 112c6bf to 0295167 Compare June 26, 2026 16:14
@mikehardy mikehardy force-pushed the functions-timeout-other-fix branch from 0295167 to 1947f41 Compare June 26, 2026 16:25
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.46%. Comparing base (4e0b2ee) to head (1947f41).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9077      +/-   ##
==========================================
+ Coverage   68.45%   68.46%   +0.02%     
==========================================
  Files         301      301              
  Lines       15878    15878              
  Branches     3304     3334      +30     
==========================================
+ Hits        10867    10870       +3     
- Misses       4782     4850      +68     
+ Partials      229      158      -71     
Flag Coverage Δ
android-native 28.62% <55.56%> (+1.70%) ⬆️
e2e-ts-android 28.62% <55.56%> (+1.70%) ⬆️
e2e-ts-macos 40.14% <66.67%> (+0.01%) ⬆️
jest 65.27% <83.34%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikehardy mikehardy merged commit 79d97f0 into main Jun 26, 2026
21 of 22 checks passed
@mikehardy mikehardy deleted the functions-timeout-other-fix branch June 26, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant