After deploying the backend server on Firebase Functions, errors occur in Google Analytics

The backend is configured with Node.js and the front end uses Vite.
We distributed what we were developing locally to Firebase Functions.

I thought there would be no problem because I used a Google Cloud Service account in the existing local area, but the API using Google Analytics alone causes 500 errors.

The following errors occur on the server terminal.

>  Error during visitor stats fetch: Error: 7 PERMISSION_DENIED: Request had insufficient authentication scopes.
>      at callErrorFromStatus (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
>      at Object.onReceiveStatus (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/client.js:193:76)
>      at Object.onReceiveStatus (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
>      at Object.onReceiveStatus (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
>      at /Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78
>      at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
>  for call at
>      at ServiceClientImpl.makeUnaryRequest (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/client.js:161:32)
>      at ServiceClientImpl.<anonymous> (/Users/user/Documents/dev/works/project-backend/functions/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
>      at /Users/user/Documents/dev/works/project-backend/functions/node_modules/@google-analytics/data/build/src/v1beta/beta_analytics_data_client.js:233:29
>      at /Users/user/Documents/dev/works/project-backend/functions/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
>      at OngoingCallPromise.call (/Users/user/Documents/dev/works/project-backend/functions/node_modules/google-gax/build/src/call.js:67:27)
>      at NormalApiCaller.call (/Users/user/Documents/dev/works/project-backend/functions/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
>      at /Users/user/Documents/dev/works/project-backend/functions/node_modules/google-gax/build/src/createApiCall.js:112:30
>      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
>    code: 7,
>    details: 'Request had insufficient authentication scopes.',
>    metadata: Metadata {
>      internalRepr: Map(4) {
>        'endpoint-load-metrics-bin' => [Array],
>        'grpc-server-stats-bin' => [Array],
>        'google.rpc.errorinfo-bin' => [Array],
>        'grpc-status-details-bin' => [Array]
>      },
>      options: {}
>    },
>    statusDetails: [
>      ErrorInfo {
>        metadata: [Object],
>        reason: 'ACCESS_TOKEN_SCOPE_INSUFFICIENT',
>        domain: 'googleapis.com'
>      }
>    ],
>    reason: 'ACCESS_TOKEN_SCOPE_INSUFFICIENT',
>    domain: 'googleapis.com',
>    errorInfoMetadata: {
>      method: 'google.analytics.data.v1beta.BetaAnalyticsData.RunReport',
>      service: 'analyticsdata.googleapis.com'
>    }
>  }

When I developed it local, I didn’t have any rights issues, so I thought there would be no errors when I deployed it to Firebase Functions.

As you can see in the picture, only visor-stats (APIs using Google Analytics) are experiencing 500 errors.

I didn’t know the problem, so I added the authority.

I am using the service account and downloaded it in json format, and I entered the file path correctly in the .env file.

Is there a new permission setting that I need to do?

Of course, Google Analytics API and Google Analytics Data API are in use.

I’d appreciate it if you could help me. ㅠㅠ

I am conducting a local test with the command below.

firebase emulators:start --only functions

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật