Skip to content

Commit

Permalink
Merge master into release
Browse files Browse the repository at this point in the history
  • Loading branch information
google-oss-bot authored May 11, 2023
2 parents 242a347 + 7bde55c commit 2cdb529
Show file tree
Hide file tree
Showing 47 changed files with 679 additions and 221 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-ways-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app': patch
---

Make the error more helpful when `getApp()` is called before `initializeApp()`.
6 changes: 6 additions & 0 deletions .changeset/long-lemons-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': minor
'firebase': minor
---

Enabled long-polling networking mode auto detection by default. It can be explicitly disabled by setting `FirestoreSettings.experimentalForceLongPolling` to `false`.
5 changes: 5 additions & 0 deletions .changeset/sixty-dolls-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app': patch
---

Catch more heartbeat read/write errors.
5 changes: 5 additions & 0 deletions .changeset/small-chairs-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/auth': patch
---

Allow port numbers in authDomain
6 changes: 6 additions & 0 deletions .changeset/witty-wasps-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': minor
'firebase': minor
---

Added the ability to configure the long-polling hanging get request timeout using the new `experimentalLongPollingOptions.timeoutSeconds` setting
84 changes: 84 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: 🐞 Bug Report V2
description: File a bug report
title: '[Bug]: '
body:
- type: markdown
id: before-you-start
attributes:
value: |
*[READ THIS]:* to evaluate if you are in the right place?
- For issues or feature requests related to __the code in this repository__, file a Github issue.
- If this is a __feature request__, make sure the issue title starts with "FR:".
- For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/) with the firebase tag.
- For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk) google group.
- For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized [Firebase support channel](https://firebase.google.com/support/).
- type: input
id: operating-system
attributes:
label: Operating System
description: Describe your operating system
placeholder: ex. iOS 16.4
validations:
required: true
- type: input
id: browser-version
attributes:
label: Browser Version
description: Describe your browser version
placeholder: ex. Safari/604.1
validations:
required: true
- type: input
id: firebase-sdk-version
attributes:
label: Firebase SDK Version
description: Describe your Firebase SDK Version
placeholder: ex. 9.16.0
validations:
required: true
- type: dropdown
id: firebase-sdk-products
attributes:
label: 'Firebase SDK Product:'
description: Which Firebase Products are used in your app?
multiple: true
options:
- Analytics
- AppCheck
- Auth
- Component
- Database
- Firestore
- Functions
- Installations
- Logger
- Messaging
- Performance
- Remote-Config
- Storage
validations:
required: true
- type: textarea
id: project-tooling
attributes:
label: Describe your project's tooling
description: Describe the tooling your app is built with
placeholder: React app with Webpack and Jest
validations:
required: true
- type: textarea
id: describe-your-problem
attributes:
label: Describe the problem
description: Describe what you were trying to do and what occurred
placeholder: |
What were you trying to accomplish? What happened? This should include a background description, log/console output, etc.
validations:
required: true
- type: textarea
id: reproduce-code
attributes:
label: Steps and code to reproduce issue
description: Please provide a description of how to replicate your issue. Copy and paste any relevant code here to reproduce the problem or links to code to reproduce it.
validations:
required: true
15 changes: 8 additions & 7 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,16 @@ jobs:
https://api.github.com/repos/firebase/firebase-js-sdk/dispatches
- name: Check for changes requiring a reference doc publish
id: docs-check
# If a diff is found (length of DIFF_CONTENTS > 0) it will write DOCS_NEEDED=true
run: |
LAST_PUBLISHED_VERSION=$(npm info firebase version)
git diff --exit-code firebase@$LAST_PUBLISHED_VERSION HEAD docs-devsite
- name: No diff, docs not needed
if: ${{ success() }}
run: echo "DOCS_NEEDED=false" >> $GITHUB_STATE
- name: Diff returned something, docs are needed
if: ${{ failure() }}
run: echo "DOCS_NEEDED=true" >> $GITHUB_STATE
DIFF_CONTENTS=$(git diff firebase@$LAST_PUBLISHED_VERSION HEAD docs-devsite)
if [ -n "$DIFF_CONTENTS" ]
then
echo "DOCS_NEEDED=true" >> $GITHUB_OUTPUT
else
echo "DOCS_NEEDED=false" >> $GITHUB_OUTPUT
fi
- name: Log to release tracker
# Sends release information to cloud functions endpoint of release tracker.
if: ${{ always() }}
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"**/node_modules": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"files.associations": { "*.json": "jsonc" }
"files.associations": { "*.json": "jsonc" },
"eslint.workingDirectories": [{ "mode": "auto" }]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ https://yarnpkg.com/en/docs/install

This repo currently supports building with yarn `1.x`. For instance, after installating yarn, run
```bash
$ yarn set version 1.22.11`
$ yarn set version 1.22.11
```

#### Java
Expand Down
6 changes: 6 additions & 0 deletions common/api-review/firestore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ export function endBefore(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstr
// @public
export function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;

// @public
export interface ExperimentalLongPollingOptions {
timeoutSeconds?: number;
}

// @public
export class FieldPath {
constructor(...fieldNames: string[]);
Expand Down Expand Up @@ -227,6 +232,7 @@ export interface FirestoreSettings {
cacheSizeBytes?: number;
experimentalAutoDetectLongPolling?: boolean;
experimentalForceLongPolling?: boolean;
experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
host?: string;
ignoreUndefinedProperties?: boolean;
localCache?: FirestoreLocalCache;
Expand Down
4 changes: 2 additions & 2 deletions docs-devsite/auth.auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface Auth
| [onAuthStateChanged(nextOrObserver, error, completed)](./auth.auth.md#authonauthstatechanged) | Adds an observer for changes to the user's sign-in state. |
| [onIdTokenChanged(nextOrObserver, error, completed)](./auth.auth.md#authonidtokenchanged) | Adds an observer for changes to the signed-in user's ID token. |
| [setPersistence(persistence)](./auth.auth.md#authsetpersistence) | Changes the type of persistence on the <code>Auth</code> instance. |
| [signOut()](./auth.auth.md#authsignout) | Signs out the current user. |
| [signOut()](./auth.auth.md#authsignout) | Signs out the current user. This does not automatically revoke the user's ID token. |
| [updateCurrentUser(user)](./auth.auth.md#authupdatecurrentuser) | Asynchronously sets the provided user as [Auth.currentUser](./auth.auth.md#authcurrentuser) on the [Auth](./auth.auth.md#auth_interface) instance. |
| [useDeviceLanguage()](./auth.auth.md#authusedevicelanguage) | Sets the current language to the default device/browser preference. |

Expand Down Expand Up @@ -247,7 +247,7 @@ auth.setPersistence(browserSessionPersistence);

## Auth.signOut()

Signs out the current user.
Signs out the current user. This does not automatically revoke the user's ID token.

<b>Signature:</b>

Expand Down
4 changes: 2 additions & 2 deletions docs-devsite/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Firebase Authentication
| <b>function(user...)</b> |
| [deleteUser(user)](./auth.md#deleteuser) | Deletes and signs out the user. |
| [getIdToken(user, forceRefresh)](./auth.md#getidtoken) | Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. |
| [getIdTokenResult(user, forceRefresh)](./auth.md#getidtokenresult) | Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service. |
| [getIdTokenResult(user, forceRefresh)](./auth.md#getidtokenresult) | Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. |
| [linkWithCredential(user, credential)](./auth.md#linkwithcredential) | Links the user account with the given credentials. |
| [linkWithPhoneNumber(user, phoneNumber, appVerifier)](./auth.md#linkwithphonenumber) | Links the user account with the given phone number. |
| [linkWithPopup(user, provider, resolver)](./auth.md#linkwithpopup) | Links the authenticated provider to the user account using a pop-up based OAuth flow. |
Expand Down Expand Up @@ -1156,7 +1156,7 @@ Promise&lt;string&gt;

## getIdTokenResult()

Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.
Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.

Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.

Expand Down
4 changes: 2 additions & 2 deletions docs-devsite/auth.user.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface User extends UserInfo
| --- | --- |
| [delete()](./auth.user.md#userdelete) | Deletes and signs out the user. |
| [getIdToken(forceRefresh)](./auth.user.md#usergetidtoken) | Returns a JSON Web Token (JWT) used to identify the user to a Firebase service. |
| [getIdTokenResult(forceRefresh)](./auth.user.md#usergetidtokenresult) | Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service. |
| [getIdTokenResult(forceRefresh)](./auth.user.md#usergetidtokenresult) | Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service. |
| [reload()](./auth.user.md#userreload) | Refreshes the user, if signed in. |
| [toJSON()](./auth.user.md#usertojson) | Returns a JSON-serializable representation of this object. |
Expand Down Expand Up @@ -154,7 +154,7 @@ Promise&lt;string&gt;
## User.getIdTokenResult()
Returns a deserialized JSON Web Token (JWT) used to identitfy the user to a Firebase service.
Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one.
Expand Down
43 changes: 43 additions & 0 deletions docs-devsite/firestore_.experimentallongpollingoptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# ExperimentalLongPollingOptions interface
Options that configure the SDK’s underlying network transport (WebChannel) when long-polling is used.

Note: This interface is "experimental" and is subject to change.

See `FirestoreSettings.experimentalAutoDetectLongPolling`<!-- -->, `FirestoreSettings.experimentalForceLongPolling`<!-- -->, and `FirestoreSettings.experimentalLongPollingOptions`<!-- -->.

<b>Signature:</b>

```typescript
export declare interface ExperimentalLongPollingOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [timeoutSeconds](./firestore_.experimentallongpollingoptions.md#experimentallongpollingoptionstimeoutseconds) | number | The desired maximum timeout interval, in seconds, to complete a long-polling GET response. Valid values are between 5 and 30, inclusive. Floating point values are allowed and will be rounded to the nearest millisecond.<!-- -->By default, when long-polling is used the "hanging GET" request sent by the client times out after 30 seconds. To request a different timeout from the server, set this setting with the desired timeout.<!-- -->Changing the default timeout may be useful, for example, if the buffering proxy that necessitated enabling long-polling in the first place has a shorter timeout for hanging GET requests, in which case setting the long-polling timeout to a shorter value, such as 25 seconds, may fix prematurely-closed hanging GET requests. For example, see https://github.com/firebase/firebase-js-sdk/issues/6987. |

## ExperimentalLongPollingOptions.timeoutSeconds

The desired maximum timeout interval, in seconds, to complete a long-polling GET response. Valid values are between 5 and 30, inclusive. Floating point values are allowed and will be rounded to the nearest millisecond.

By default, when long-polling is used the "hanging GET" request sent by the client times out after 30 seconds. To request a different timeout from the server, set this setting with the desired timeout.

Changing the default timeout may be useful, for example, if the buffering proxy that necessitated enabling long-polling in the first place has a shorter timeout for hanging GET requests, in which case setting the long-polling timeout to a shorter value, such as 25 seconds, may fix prematurely-closed hanging GET requests. For example, see https://github.com/firebase/firebase-js-sdk/issues/6987.

<b>Signature:</b>

```typescript
timeoutSeconds?: number;
```
17 changes: 15 additions & 2 deletions docs-devsite/firestore_.firestoresettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export declare interface FirestoreSettings
| Property | Type | Description |
| --- | --- | --- |
| [cacheSizeBytes](./firestore_.firestoresettings.md#firestoresettingscachesizebytes) | number | NOTE: This field will be deprecated in a future major release. Use <code>cache</code> field instead to specify cache size, and other cache configurations.<!-- -->An approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.<!-- -->The default value is 40 MB. The threshold must be set to at least 1 MB, and can be set to <code>CACHE_SIZE_UNLIMITED</code> to disable garbage collection. |
| [experimentalAutoDetectLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalautodetectlongpolling) | boolean | Configures the SDK's underlying transport (WebChannel) to automatically detect if long-polling should be used. This is very similar to <code>experimentalForceLongPolling</code>, but only uses long-polling if required.<!-- -->This setting will likely be enabled by default in future releases and cannot be combined with <code>experimentalForceLongPolling</code>. |
| [experimentalAutoDetectLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalautodetectlongpolling) | boolean | Configures the SDK's underlying transport (WebChannel) to automatically detect if long-polling should be used. This is very similar to <code>experimentalForceLongPolling</code>, but only uses long-polling if required.<!-- -->After having had a default value of <code>false</code> since its inception in 2019, the default value of this setting was changed in mid-2023 to <code>true</code>. That is, auto-detection of long polling is now enabled by default. To disable it, set this setting to <code>false</code>, and please open a GitHub issue to share the problems that motivated you disabling long-polling auto-detection. |
| [experimentalForceLongPolling](./firestore_.firestoresettings.md#firestoresettingsexperimentalforcelongpolling) | boolean | Forces the SDKs underlying network transport (WebChannel) to use long-polling. Each response from the backend will be closed immediately after the backend sends data (by default responses are kept open in case the backend has more data to send). This avoids incompatibility issues with certain proxies, antivirus software, etc. that incorrectly buffer traffic indefinitely. Use of this option will cause some performance degradation though.<!-- -->This setting cannot be used with <code>experimentalAutoDetectLongPolling</code> and may be removed in a future release. If you find yourself using it to work around a specific network reliability issue, please tell us about it in https://github.com/firebase/firebase-js-sdk/issues/1674. |
| [experimentalLongPollingOptions](./firestore_.firestoresettings.md#firestoresettingsexperimentallongpollingoptions) | [ExperimentalLongPollingOptions](./firestore_.experimentallongpollingoptions.md#experimentallongpollingoptions_interface) | Options that configure the SDKs underlying network transport (WebChannel) when long-polling is used.<!-- -->These options are only used if <code>experimentalForceLongPolling</code> is true or if <code>experimentalAutoDetectLongPolling</code> is true and the auto-detection determined that long-polling was needed. Otherwise, these options have no effect. |
| [host](./firestore_.firestoresettings.md#firestoresettingshost) | string | The hostname to connect to. |
| [ignoreUndefinedProperties](./firestore_.firestoresettings.md#firestoresettingsignoreundefinedproperties) | boolean | Whether to skip nested properties that are set to <code>undefined</code> during object serialization. If set to <code>true</code>, these properties are skipped and not written to Firestore. If set to <code>false</code> or omitted, the SDK throws an exception when it encounters properties of type <code>undefined</code>. |
| [localCache](./firestore_.firestoresettings.md#firestoresettingslocalcache) | [FirestoreLocalCache](./firestore_.md#firestorelocalcache) | Specifies the cache used by the SDK. Available options are <code>MemoryLocalCache</code> and <code>IndexedDbLocalCache</code>, each with different configuration options.<!-- -->When unspecified, <code>MemoryLocalCache</code> will be used by default.<!-- -->NOTE: setting this field and <code>cacheSizeBytes</code> at the same time will throw exception during SDK initialization. Instead, using the configuration in the <code>FirestoreLocalCache</code> object to specify the cache size. |
Expand All @@ -48,7 +49,7 @@ cacheSizeBytes?: number;

Configures the SDK's underlying transport (WebChannel) to automatically detect if long-polling should be used. This is very similar to `experimentalForceLongPolling`<!-- -->, but only uses long-polling if required.

This setting will likely be enabled by default in future releases and cannot be combined with `experimentalForceLongPolling`<!-- -->.
After having had a default value of `false` since its inception in 2019, the default value of this setting was changed in mid-2023 to `true`<!-- -->. That is, auto-detection of long polling is now enabled by default. To disable it, set this setting to `false`<!-- -->, and please open a GitHub issue to share the problems that motivated you disabling long-polling auto-detection.

<b>Signature:</b>

Expand All @@ -68,6 +69,18 @@ This setting cannot be used with `experimentalAutoDetectLongPolling` and may be
experimentalForceLongPolling?: boolean;
```

## FirestoreSettings.experimentalLongPollingOptions

Options that configure the SDKs underlying network transport (WebChannel) when long-polling is used.

These options are only used if `experimentalForceLongPolling` is true or if `experimentalAutoDetectLongPolling` is true and the auto-detection determined that long-polling was needed. Otherwise, these options have no effect.

<b>Signature:</b>

```typescript
experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
```

## FirestoreSettings.host

The hostname to connect to.
Expand Down
Loading

0 comments on commit 2cdb529

Please sign in to comment.