Node.js in docker-compose container can’t access resource using absolute path

I’m having Node.js that I’m trying to dockerize. There is a piece of code that provides Google Application Credentials stored in serviceAccount.json file that looks like this:

const googleApplicationCredentials = config.GOOGLE_APPLICATION_CREDENTIALS;
const serviceAccount = require(googleApplicationCredentials);

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "https://databasename.firebaseio.com"
});

Path to this credential file is pulled from docker-compose which looks like this:

  api:
    build:
      dockerfile: Dockerfile.dev
      context: ./server
    volumes:
      - /app/node_modules
      - ./server:/app
    environment:
      - GOOGLE_APPLICATION_CREDENTIALS="/app/serviceAccount.json"

Docker file is this:

FROM node:14.14.0-alpine
WORKDIR "/app"
COPY ./package.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "start"]

When I ssh to docker container, I can see serviceAccount.json under working directory /app.
However, when I start docker-componse I’m getting the following error:

Cred:"/app/serviceAccount.json"
api_1     | internal/modules/cjs/loader.js:883
api_1     |   throw err;
api_1     |   ^
api_1     |
api_1     | Error: Cannot find module '"/app/serviceAccount.json"'
api_1     | Require stack:
api_1     | - /app/src/firebaseInit.js
api_1     | - /app/src/services/notification.service.js
api_1     | - /app/src/controllers/messages.controller.js
api_1     | - /app/src/routes/consultingchannel.routes.js
api_1     | - /app/src/express.js
api_1     | - /app/src/server.js
api_1     |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
api_1     |     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
api_1     |     at Module.require (internal/modules/cjs/loader.js:952:19)
api_1     |     at require (internal/modules/cjs/helpers.js:88:18)
api_1     |     at Object.<anonymous> (/app/src/firebaseInit.js:8:24)
api_1     |     at Module._compile (internal/modules/cjs/loader.js:1063:30)
api_1     |     at Module._compile (/app/node_modules/pirates/lib/index.js:99:24)
api_1     |     at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
api_1     |     at Object.newLoader [as .js] (/app/node_modules/pirates/lib/index.js:104:7)
api_1     |     at Module.load (internal/modules/cjs/loader.js:928:32)
api_1     |     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
api_1     |     at Module.require (internal/modules/cjs/loader.js:952:19)
api_1     |     at require (internal/modules/cjs/helpers.js:88:18)
api_1     |     at Object.<anonymous> (/app/src/services/notification.service.js:4:1)
api_1     |     at Module._compile (internal/modules/cjs/loader.js:1063:30)
api_1     |     at Module._compile (/app/node_modules/pirates/lib/index.js:99:24)
api_1     |     at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
api_1     |     at Object.newLoader [as .js] (/app/node_modules/pirates/lib/index.js:104:7)
api_1     |     at Module.load (internal/modules/cjs/loader.js:928:32)
api_1     |     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
api_1     |     at Module.require (internal/modules/cjs/loader.js:952:19)
api_1     |     at require (internal/modules/cjs/helpers.js:88:18) {
api_1     |   code: 'MODULE_NOT_FOUND',
api_1     |   requireStack: [
api_1     |     '/app/src/firebaseInit.js',
api_1     |     '/app/src/services/notification.service.js',
api_1     |     '/app/src/controllers/messages.controller.js',
api_1     |     '/app/src/routes/consultingchannel.routes.js',
api_1     |     '/app/src/express.js',
api_1     |     '/app/src/server.js'
api_1     |   ]
api_1     | }
api_1     | [nodemon] app crashed - waiting for file changes before starting...
client_1  | Compiled with warnings.

Source: Docker Questions