Skip to content
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

Rework apps, update admin, remove lodash #1144

Merged
merged 3 commits into from
Jun 27, 2022
Merged

Rework apps, update admin, remove lodash #1144

merged 3 commits into from
Jun 27, 2022

Conversation

inlined
Copy link
Member

@inlined inlined commented Jun 17, 2022

This change involved a number of small things that kinda got smushed together. Sorry.

  1. I changed the "apps" library. It originally was supposed to hold a refcounted copy of apps logged in with user auth overrides. Ripping all that code out felt good! (including ripping out before and after in makeCloudFunction. Importantly, we will now share the default app if it already exists when we need it. This should help consolidate network connections/caches. OTOH, it could lead to subtle bugs. Push back if you think this optimization is too dangerous.
  2. Since we updated the admin SDK version in launch.next already, I switched over to the v10 syntax so that we load fewer files on demand.
  3. I cleaned up lodash in a few files and decided to pull on the thread until lodash is removed from the SDK entirely.
  4. In order to efficiently implement a lodash method, I had to raise the typescript target to ES2019, which is covered by our new supported engines (14 & 16)

Copy link
Contributor

@colerogers colerogers left a comment

Choose a reason for hiding this comment

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

Couple leftover comments

import {
App,
applicationDefault,
// getApp as getAppNamed,
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this comment

export function getApp(): App {
// if (typeof cache === 'undefined') {
// cache = getAppNamed(/* default */);
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

remove these comments

@@ -55,6 +52,8 @@ export {
logger,
};

export const app = { setEmulatedAdminApp };
Copy link
Contributor

Choose a reason for hiding this comment

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

sigh I wish I knew why this function is needed for the emulator to work.

(I have a theory that this is just a historical artifact before admin sdk natively supported the emulator)

* N.B. For clarity for use in testing this name has no mention of emulation, but
* it must be exported from index as app.setEmulatedAdminApp or we break the emulator.
* We can remove this export when:
* A) We complete the new emulator and no longer depend on monkeypatching
Copy link
Contributor

Choose a reason for hiding this comment

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

actively researching this. I think recent versions of the admin sdk doesn't rely on this monkey patching, and I'll try to confirm/deny this.

@taeold taeold added this to the v4 milestone Jun 24, 2022
@inlined
Copy link
Member Author

inlined commented Jun 26, 2022

@colerogers You left this with a change request. Does uncommenting those lines fix everything?

@inlined inlined merged commit bebb398 into launch.next Jun 27, 2022
@inlined inlined deleted the inlined.apps branch June 27, 2022 19:17
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.

None yet

3 participants