Skip to content

Hosting SSR region - #5504

Merged
jamesdaniels merged 15 commits into
masterfrom
chalosalvador-hosting-ssr-region
Feb 14, 2023
Merged

jamesdaniels merged 15 commits into
masterfrom
chalosalvador-hosting-ssr-region

Conversation

@chalosalvador

Copy link
Copy Markdown
Member

Description

Add the ability to set the region of a web framework's generated SSR function.

  • Add initialization step to choose region to host server-side content
  • Validate region in prepareFrameworks
  • Add custom region in functions.yaml and the cloud function

Scenarios Tested

  1. Initialize a firebase hosting project with a web framework
  • Verify that the "choose a region" step is added to the initialization steps.
  • Verify that the firebase.json file includes the frameworksBackend property with the chosen region.
  • Run firebase deploy with and without the necessity of a backend.
    • When deploying with necessity of a backend, verify that the functions.yaml contains the correct region and the server.js file contains the cloud function with the correct region added to it.
  • Verify that the cloud function is actually created in the correct region.
  1. Manually change the region in firebase.json and verify that the CLI asks to delete or keep the current deployed cloud function with the old region.
  2. Set an invalid region the firebase.json and verify that the CLI fails with the appropriate error message.

Sample Commands

- Add initialization step to choose region
- Validate region in prepareFrameworks
- Add custom region in functions.yaml and the cloud function
Comment thread schema/firebase-config.json Resolved
Comment thread src/frameworks/index.ts Resolved
Comment thread src/frameworks/index.ts Resolved
Comment thread src/frameworks/index.ts Resolved
Comment thread src/init/features/hosting/index.ts Resolved
Comment thread src/init/features/hosting/index.ts Resolved
@codecov-commenter

codecov-commenter commented Feb 13, 2023 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.14%. Comparing base (d6d396a) to head (c0c8eee).

Files with missing lines Patch % Lines
src/frameworks/index.ts 18.18% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5504      +/-   ##
==========================================
- Coverage   56.15%   56.14%   -0.02%     
==========================================
  Files         317      317              
  Lines       21496    21503       +7     
  Branches     4385     4388       +3     
==========================================
+ Hits        12071    12072       +1     
- Misses       8363     8369       +6     
  Partials     1062     1062              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

chalosalvador and others added 3 commits February 13, 2023 22:34
- Reuse ALLOWED_SSR_REGIONS
- Add default region to prompt
- Add all the frameworksBackend properties to function args.
…e/firebase-tools into chalosalvador-hosting-ssr-region
Comment thread src/frameworks/index.ts Resolved
Comment thread src/frameworks/index.ts Resolved

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

Made a few small changes, let's :shipit:

@jamesdaniels
jamesdaniels enabled auto-merge (squash) February 14, 2023 21:33
@jamesdaniels
jamesdaniels merged commit d6826ee into master Feb 14, 2023
@jamesdaniels
jamesdaniels deleted the chalosalvador-hosting-ssr-region branch February 14, 2023 23:46
Comment thread src/frameworks/index.ts
export const DEFAULT_REGION = "us-central1";
export const NODE_VERSION = parseInt(process.versions.node, 10).toString();
export const DEFAULT_REGION = "us-central1";
export const ALLOWED_SSR_REGIONS = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi, is there a motive behind limiting the regions? For example, we currently use europe-west2 (London) but it seems this configuration would be disallowed?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's because cloud Functions V2 are only available in those regions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@tamerxkilinc This page https://cloud.google.com/functions/docs/locations?hl=en#tier_2_pricing shows that Cloud Functions v2 are currently supported in many more regions. Does that mean we can already use them or are there other limiting factors?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be possible to use the new regions now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants