Netlify does not see the service-account-credentials.json file

I have a big problem that I haven’t been able to solve for 2 days. To send push notifications to users on the site, I use firebase cloud messaging in nuxt 3. On localhost everything works fine, since it finds the json file for use by firebase-admin (I added json to both the project root and the public folder).

We are talking about GOOGLE_APPLICATION_CREDENTIALS and service-account-credentials.json.

Without adding this line to the .env file, push notifications are not sent, POST 500 errors are issued. I deploy the site to Netlify, and this file is located in the repository in two places.

I also added an environment variable to the site in the form GOOGLE_APPLICATION_CREDENTIALS = ./service-account-credentials.json (tried ./public/service-account-credentials.json, public/service-account-credentials.json, service-account-credentials .json) and always get the same error.

Failed to parse service account json file: Error: ENOENT: no such file or directory, open 'service-account-credentials.json'.

I am attaching some code that may help in investigating the problem.

import { initializeApp, deleteApp } from "firebase-admin/app";
import { getMessaging } from "firebase-admin/messaging";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();

interface IRequestBody {
  title: string;
  message: string;
  phoneNumber: string

export default defineEventHandler(async (event) => {
  const { title, message, phoneNumber } = await readBody<IRequestBody>(event);

  const app = initializeApp();
  const messaging = getMessaging(app);
  let tokensArray: string[] = []

  try {
    const clientDevices = await prisma.clientDevicesToken.findMany({
      where: {
    tokensArray = => device.token);
  } catch (error) {
    if (error instanceof Error) {
      return { error: error.message };
  await messaging.sendEachForMulticast({
    tokens: tokensArray,
    notification:  {
      title: title,
      body: message,

  messaging.sendToTopic("topic", { notification: {} });

Did you refer to: How to Include Files in Netlify Serverless Functions

To be honest, I’m not very good at setting up the netlify configuration and I don’t quite understand what I need to do. that is, to include a json file in a netlify build, do I need to write something like this in netlify.toml?

  included_files = ["service-account-credentials.json"]

Where exactly in your repo does that file exist? You need to mention that path in the config.

Thanks a lot, the method worked.