액티브 스킬

<파이어베이스> 카카오 로그인 + firebase auth 개발 중 functions deploy 에러

디벅잉 2023. 1. 28. 23:27
728x90

 

🧭

 

파이어베이스 functions를 활용해서 카카오 로그인을 firebase auth와 연동하고 있습니다. (아래 첨부 유튜브 참고하여 진행)

 

에러#1 - firebase deploy 실패

예제를 따라하다  함수를 배포하기 위해 $ firebase deploy를 입력하는 순간, 아래와 같은 에러가 발생했습니다.

Parsing error: Cannot read file '/users/mies/firebaseprojects/{MyProject}/functions/functions/tsconfig.json'

/functions가 2번 반복되는 것이 문제인 것 같은데 해결방법을 찾기 못해 stackoverflow에 질문을 올렸고, 답변 받은 내용으로 .eslintrc.js 파일을 수정하여 다음 단계로 진행하게 되었습니다.

https://stackoverflow.com/questions/75267128/how-to-resolve-firebase-deploy-parsing-error-cannot-read-file/75267245?noredirect=1#comment132816373_75267245 

 

How to resolve firebase deploy Parsing error: Cannot read file

I tried firebase deploy functions first time today. When I command $ firebase deploy in the terminal, Parsing error occurred like below. I found tsconfig.json file path is strange. Functions direct...

stackoverflow.com

 

에러#2 - functions/lib/index.js does not exist

하지만 deploy는 다시 한번 실패했습니다.

index.js 파일은 lib/src 아래에 생성되었는데, lib/index.js 파일을 찾고 있으니 문제가 되었습니다.

package.json 파일에서 main 값을 수정해서 다음단계로 진행하였습니다.

"main": "lib/src/index.js",

 

에러#3 - Permission 'storage.objects.create' denied

예제를 따라하다보면 firebase admin sdk를 사용하게 위해 서비스 계정을 이용하는데, 서비스 계정(service account)에 권한이 없는 경우 deploy를 할 수 없습니다.

google cloud에서 firebase에 연동된 계정에 필요한 권한(제 경우 'AI Platform 서비스 에이전트')을 부여하니 드디어 deploy가 성공했습니다.

 

📌

 

https://www.youtube.com/watch?v=Akt91Cl_z00 

https://dev.to/wceolin/functions-lib-index-js-does-not-exist-can-t-deploy-cloud-functions-3344

 

functions/lib/index.js does not exist, can't deploy Cloud Functions

Sometimes when you're deploying a monorepo to Cloud Functions for Firebase, you'll get the following...

dev.to

 

728x90