Firebase Functions
Firebase Cloud Function 시작하기 : [링크]
시작하기: 첫 번째 함수 작성, 테스트, 배포 | Firebase Documentation
Catch up on everthing we announced at this year's Firebase Summit. Learn more 의견 보내기 시작하기: 첫 번째 함수 작성, 테스트, 배포 Cloud Functions를 시작하려면 이 튜토리얼을 따라해 보세요. 이 튜토리얼은 필수
firebase.google.com
Firebase Functions를 사용하려면 Node.js의 설치가 필요하다.
Firebase CLI 설치 : [링크]
Firebase CLI 참조 | Firebase Documentation
Test SDK for Cloud Functions for Firebase
firebase.google.com

NodeJS 링크를 클릭해서 설치한다.

명령 프롬프트를 관리자 권한으로 실행해서 다음의 명령어를 입력한다.
npm install -g firebase-tools

설치가 끝나면 권한 설정을 해야 한다.
firebase login
을 입력하면 연결된 계정을 선택하면 다음과 같이 CLI가 로그인이 된다.


firebase function을 설치한다. 경로를 자신의 프로젝트 하위로 설정하는 게 좋은 것 같다.
프로젝트마다 바라보는 경로를 구분해야 하는 경우가 많기 때문이다.

본인에 맞는 옵션을 선택한다. (Type Script / java Script)
모두다 설치가 되면 해당 경로에 functions 폴더가 있는데
functions - src - index.ts (Type Script)를 IDE로 파일을 연다.


해당 파일의 주석을 지우고 저장합니다.
firebase function 을 배포해보자.
이후에 firebase deploy --only functions를 통해서 작성한

Error HTTP Error 400, Billing account for project '~' is not found, Billing must be
에러가 뜨는건 function을 사용하려면 무료 버전에서는 불가능하다는 에러이다.

400 Billing account for project is not found. Billing must be enabled for activation of service(s)
I am create API with firebase via this tutorial here. On I run: firebase deploy I get this error on the command line: HTTP Error: 400, Billing account for project '381106441303' is not found. Bi...
stackoverflow.com

node. js의 버전을 10 -> 8로 변경하고 다시 Deploy..
Error: HTTP Error: 403, Unknown Error 에러가 났다.
참고 URL : github.com/firebase/firebase-tools/issues/641
Error: HTTP Error: 403, Unknown Error · Issue #641 · firebase/firebase-tools
Version info 3.17.4 Steps to reproduce OS X 10.12.6 node -v v8.9.3 tree . . |-- firebase.json `-- public `-- index.html 1 directory, 2 files ls -a .firebaserc firebase.json public Then I run fireba...
github.com
다시 firebase logout / firebase login 이후에 deploy 하니 성공했다.
firebase deploy --only functions


업로드된 URL 주소를 복사해서 실행하면 인덱스에 기록된 내용이 잘 나온다.

테스트하는데 꽤나 많은 삽질을 했어서.. 험험. 고생했다.
Java Script도 비슷한 형태이다.

★★☆☆☆
'개발 > 게임) 개발관련' 카테고리의 다른 글
개발) 자주 사용하는 유용한 Git 명령어 정리 (Git Command) (0) | 2020.11.05 |
---|---|
개발용어) TCP(Transmission Control Protocol) Flag 종류 (2) | 2020.11.02 |
Tip) Firebase SDK old version URL (0) | 2020.10.19 |
개발환경) 애플 개발자 등록 (Apple Developer) (1) | 2020.10.08 |
Tip) VSCode에서 DLL이 인식이 안되는경우 (0) | 2020.09.23 |
댓글