-
Notifications
You must be signed in to change notification settings - Fork 949
Add precondition format checks against api-key and app-id #3562
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset is good to goLatest commit: 64edab6 We got this. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Binary Size ReportAffected SDKs
Test Logs
|
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.
Please add a changeset (which is used for generating release notes) to this PR. The instruction for how to do so is included in the Workflow check failures.
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.
LGTM . Please add an changeset to this.
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.
Can you merge with master to refresh the size analysis? Currently it shows a 5% size increase which is too big and doesn't sound accurate.
@@ -30,6 +32,14 @@ export const enum ErrorCode { | |||
const ERROR_DESCRIPTION_MAP: { readonly [key in ErrorCode]: string } = { | |||
[ErrorCode.MISSING_APP_CONFIG_VALUES]: | |||
'Missing App configuration value: "{$valueName}"', | |||
[ErrorCode.INVALID_APP_ID_FORMAT]: | |||
'Please set your Application ID. A valid Firebase App ID is required to communicate ' + |
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 message sounds like the app id is missing, but the error is actually a malformed appId. I would also just use appId
which matches the name in the config object.
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.
makes sense. done
'with Firebase server APIs: It identifies your application with Firebase.' + | ||
'Please refer to https://firebase.google.com/support/privacy/init-options.', | ||
[ErrorCode.INVALID_API_KEY_FORMAT]: | ||
'Please set a valid API key. A Firebase API key is required to communicate with ' + |
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.
Similarly I would just use apiKey
to match the name in the config object.
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.
done
@@ -33,7 +33,10 @@ export function newTestFirestore( | |||
} | |||
const app = | |||
typeof nameOrApp === 'string' | |||
? firebase.initializeApp({ apiKey: 'fake-api-key', projectId }, nameOrApp) | |||
? firebase.initializeApp( | |||
{ apiKey: 'A-test-api-key-jklmnopqrstuvwxyz1234567', projectId }, |
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.
Does the test fail without the change? I think you only need the correct format in installation tests, specifically the tests that involves extractAppConfig()
. We can leave other places unchanged, right?
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.
Yeah, I saw many tests were failing so I added these changes.
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.
That is weird. I don't think your change affects firestore. Are you sure the failure comes from firestore? It will be really inconvenient if we are forced use exact 38 characters apiKey in tests.
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.
Removing this from my list of review-requests.
Added FIS client side precondition checks for JS SDK as we did for Android SDK.
Added precondition format checks for App-Id and Api-Key firebase-android-sdk#1470
Add tests for FIS format check firebase-android-sdk#1502
Move FIS precondition format check to installation constructor firebase-android-sdk#1507
Fixed invalid test Api keys and App ids for affected integration tests and unit tests.