2025년 8월 16일 토요일
firebase Cloud Functions
$ npm install -g firebase-tools
프로젝트 시작:
$ firebase init
함수 배포:
$ firebase deploy
C:\Users\leeho\firebasenode>firebase login
i The Firebase CLI’s MCP server feature can optionally make use of Gemini in Firebase. Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data
√ Enable Gemini in Firebase features? Yes
i Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
√ Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Yes
i To change your preferences at any time, run `firebase logout` and `firebase login` again.
Visit this URL on this device to log in:
C:\Users\leeho\firebasenode>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
C:\Users\leeho\firebasenode
√ Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to
confirm your choices. (Press to select, to toggle all, to invert selection, and to proceed)
>( ) Data Connect: Set up a Firebase Data Connect service
( ) Firestore: Configure security rules and indexes files for Firestore
( ) Genkit: Setup a new Genkit project with Firebase
( ) Functions: Configure a Cloud Functions directory and its files
( ) App Hosting: Enable web app deployments with App Hosting
( ) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
( ) Storage: Configure a security rules file for Cloud Storage
√ Are you ready to proceed? Yes
√ Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to
confirm your choices. Data Connect: Set up a Firebase Data Connect service, Firestore: Configure security rules and
indexes files for Firestore, Genkit: Setup a new Genkit project with Firebase, Functions: Configure a Cloud Functions
directory and its files, App Hosting: Enable web app deployments with App Hosting, Hosting: Configure files for Firebase
Hosting and (optionally) set up GitHub Action deploys, Storage: Configure a security rules file for Cloud Storage,
Emulators: Set up local emulators for Firebase products, Remote Config: Configure a template file for Remote Config,
Extensions: Set up an empty Extensions manifest, Realtime Database: Configure a security rules file for Realtime
Database and (optionally) provision default instance
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
√ Please select an option: Use an existing project
√ Select a default Firebase project for this directory: clostr-510ae (Clostr)
i Using project clostr-510ae (Clostr)
=== Dataconnect Setup
i dataconnect: ensuring required API sqladmin.googleapis.com is enabled...
! dataconnect: missing required API sqladmin.googleapis.com. Enabling now...
i dataconnect: ensuring required API firebasedataconnect.googleapis.com is enabled...
! dataconnect: missing required API firebasedataconnect.googleapis.com. Enabling now...
+ Wrote dataconnect\dataconnect.yaml
+ Wrote dataconnect\schema\schema.gql
+ Wrote dataconnect\connector\connector.yaml
+ Wrote dataconnect\connector\queries.gql
+ Wrote dataconnect\connector\mutations.gql
i If you'd like to add the generated SDK to your app later, run firebase init dataconnect:sdk
i If you'd like to provision a CloudSQL Postgres instance on the Firebase Data Connect no-cost trial:
1. Please upgrade to the pay-as-you-go (Blaze) billing plan. Visit the following page:
https://console.firebase.google.com/project/clostr-510ae/usage/details
2. Run firebase init dataconnect again to configure the Cloud SQL instance.
3. Run firebase deploy --only dataconnect to deploy your Data Connect service.
=== Firestore Setup
i firestore: ensuring required API firestore.googleapis.com is enabled...
! firestore: missing required API firestore.googleapis.com. Enabling now...
√ Please select the location of your Firestore database: asia-east1
√ What file should be used for Firestore Rules? y
Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.
? What file should be used for Firestore indexes? (firestore.indexes.json)
√ What file should be used for Firestore indexes? y
+ Wrote y
+ Wrote y
=== Genkit Setup
√ Genkit's Firebase integration uses Cloud Functions for Firebase with TypeScript.
Initialize Functions to continue? Yes
Let's create a new codebase for your functions.
A directory corresponding to the codebase will be created in your project
with sample code pre-configured.
See https://firebase.google.com/docs/functions/organize-functions for
more information on organizing your functions using codebases.
Functions can be deployed with firebase deploy.
√ Do you want to use ESLint to catch probable bugs and enforce style? Yes
+ Wrote functions/package.json
+ Wrote functions/.eslintrc.js
+ Wrote functions/tsconfig.dev.json
+ Wrote functions/tsconfig.json
+ Wrote functions/src/index.ts
+ Wrote functions/.gitignore
√ Do you want to install dependencies with npm now? Yes
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
added 692 packages in 1m
162 packages are looking for funding
run `npm fund` for details
? Install the Genkit CLI globally or locally in this project?
> Globally
Just this project
Installing the Genkit CLI globally is recommended because it provides access to the Genkit developer tools, including the Developer UI, from any directory on your system. This makes it easier to test and debug your application. A global installation is also preferred for command-line tools that you'll use across multiple projects.
? What language would you like to use to write Cloud Functions?
Google Cloud Functions can be written in several languages, but TypeScript is the recommended choice for Genkit projects.
Recommended Language: TypeScript
TypeScript is a superset of JavaScript that adds static typing. Genkit is built with TypeScript, and its features—like type-safe functions, autocompletion, and robust error-checking—make development easier and more reliable.
Key benefits of using TypeScript with Genkit:
Type Safety: Helps you catch errors early, before you even deploy your code.
Better Developer Experience: Provides excellent autocompletion and code hints in your IDE.
Alignment with Genkit: Genkit's libraries and functions are fully typed, so you get the best experience when using them with TypeScript.
While you can also write Cloud Functions in JavaScript, Python, Go, Java, and other languages, the Genkit library and developer tools are specifically designed to be used with the Node.js runtime, which pairs best with TypeScript.
i genkit: Generating sample file
+ genkit: Successfully generated sample file (src/genkit-sample.ts)
Login to Google Cloud using:
gcloud auth application-default login --project clostr-510ae
Then start the Genkit developer experience by running:
cd functions && npm run genkit:start
=== Functions Setup
Detected existing codebase(s): default
√ Would you like to initialize a new codebase, or overwrite an existing one? Initialize
Let's create a new codebase for your functions.
A directory corresponding to the codebase will be created in your project
with sample code pre-configured.
See https://firebase.google.com/docs/functions/organize-functions for
more information on organizing your functions using codebases.
Functions can be deployed with firebase deploy.
√ What should be the name of this codebase? Genkit_conect_app
Invalid codebase name. Codebase must be less than 64 characters and can contain only lowercase letters, numeric characters, underscores, and dashes.
√ What should be the name of this codebase? GenkitConactApp
Invalid codebase name. Codebase must be less than 64 characters and can contain only lowercase letters, numeric characters, underscores, and dashes.
√ What should be the name of this codebase? Genkit-connect-app
Invalid codebase name. Codebase must be less than 64 characters and can contain only lowercase letters, numeric characters, underscores, and dashes.
√ What should be the name of this codebase? genkit-connect-app
√ In what sub-directory would you like to initialize your functions for codebase genkit-connect-app? genkit-connect-app
√ What language would you like to use to write Cloud Functions? TypeScript
√ Do you want to use ESLint to catch probable bugs and enforce style? Yes
+ Wrote genkit-connect-app/package.json
+ Wrote genkit-connect-app/.eslintrc.js
+ Wrote genkit-connect-app/tsconfig.dev.json
+ Wrote genkit-connect-app/tsconfig.json
+ Wrote genkit-connect-app/src/index.ts
+ Wrote genkit-connect-app/.gitignore
√ Do you want to install dependencies with npm now? Yes
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
added 692 packages in 2m
162 packages are looking for funding
run `npm fund` for details
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기