Skip to content

Rework apps, update admin, remove lodash - #1144

Merged
inlined merged 3 commits into
launch.nextfrom
inlined.apps
Jun 27, 2022
Merged

Rework apps, update admin, remove lodash#1144
inlined merged 3 commits into
launch.nextfrom
inlined.apps

Conversation

@inlined

@inlined inlined commented Jun 17, 2022

Copy link
Copy Markdown
Member

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)

@inlined
inlined requested review from colerogers and taeold June 17, 2022 00:21

@colerogers colerogers 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.

Couple leftover comments

Comment thread src/common/app.ts Outdated
import {
App,
applicationDefault,
// getApp as getAppNamed,

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.

remove this comment

Comment thread src/common/app.ts Outdated
export function getApp(): App {
// if (typeof cache === 'undefined') {
// cache = getAppNamed(/* default */);
// }

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.

remove these comments

Comment thread src/index.ts
logger,
};

export const app = { setEmulatedAdminApp };

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.

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)

Comment thread src/common/app.ts
* 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
Copy Markdown
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

inlined commented Jun 26, 2022

Copy link
Copy Markdown
Member Author

@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.

3 participants