Functions-samples: Error deploying google-sheet-sync - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string

Created on 9 Jan 2019  ·  2Comments  ·  Source: firebase/functions-samples

How to reproduce these conditions

Sample name or URL where you found the bug

https://github.com/firebase/functions-samples/tree/Node-8/google-sheet-sync

Failing Function code used (including require/import commands at the top)

I have followed all the steps successfully up to step 10, but step 11 (Deploy your project using firebase deploy) returns an error.

Steps to set up and reproduce

Run all steps up to step 10, then try to run firebase deploy

Sample data pasted or attached as JSON (not an image)

In the terminal i get the following:

❯ firebase deploy

=== Deploying to 'trello-sync-test'...

i  deploying functions, hosting
i  functions: ensuring necessary APIs are enabled...
✔  functions: all necessary APIs are enabled

Error: An unexpected error has occurred.

Contents of firebase-debug.log:

[debug] [2019-01-09T16:22:16.491Z] ----------------------------------------------------------------------
[debug] [2019-01-09T16:22:16.493Z] Command:       /usr/local/Cellar/node/11.4.0/bin/node /usr/local/bin/firebase deploy
[debug] [2019-01-09T16:22:16.494Z] CLI Version:   6.2.2
[debug] [2019-01-09T16:22:16.494Z] Platform:      darwin
[debug] [2019-01-09T16:22:16.494Z] Node Version:  v11.4.0
[debug] [2019-01-09T16:22:16.509Z] Time:          Wed Jan 09 2019 16:22:16 GMT+0000 (Greenwich Mean Time)
[debug] [2019-01-09T16:22:16.509Z] ----------------------------------------------------------------------
[debug] 
[debug] [2019-01-09T16:22:16.524Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2019-01-09T16:22:16.524Z] > authorizing via signed-in user
[debug] [2019-01-09T16:22:16.524Z] [iam] checking project trello-sync-test for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get","firebasehosting.sites.update"]
[debug] [2019-01-09T16:22:16.526Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/trello-sync-test:testIamPermissions  

[debug] [2019-01-09T16:22:17.330Z] <<< HTTP RESPONSE 200
[debug] [2019-01-09T16:22:17.332Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/trello-sync-test  

[debug] [2019-01-09T16:22:17.503Z] <<< HTTP RESPONSE 200
[info] 
[info] === Deploying to 'trello-sync-test'...
[info] 
[info] i  deploying functions, hosting
[debug] [2019-01-09T16:22:23.067Z] > [functions] package.json contents: {
  "name": "google-sheet-sync",
  "description": "Syncs new Firebase data to a Google Sheet",
  "dependencies": {
    "ajv": "^5.0.0",
    "firebase-admin": "^6.0.0",
    "firebase-functions": "^2.1.0",
    "google-auth-library": "^1.6.1",
    "googleapis": "^27.0.0"
  },
  "devDependencies": {
    "eslint": "^4.13.1",
    "eslint-plugin-promise": "^3.6.0"
  },
  "scripts": {
    "lint": "./node_modules/.bin/eslint --max-warnings=0 .",
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "8"
  },
  "private": true
}
[info] i  functions: ensuring necessary APIs are enabled...
[debug] [2019-01-09T16:22:23.068Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/trello-sync-test?view=CONSUMER_VIEW  

[debug] [2019-01-09T16:22:23.068Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/trello-sync-test?view=CONSUMER_VIEW  

[debug] [2019-01-09T16:22:24.297Z] <<< HTTP RESPONSE 200
[info] ✔  functions: all necessary APIs are enabled
[debug] [2019-01-09T16:22:24.316Z] <<< HTTP RESPONSE 200
[debug] [2019-01-09T16:22:24.317Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/trello-sync-test  

[debug] [2019-01-09T16:22:25.024Z] <<< HTTP RESPONSE 200
[debug] [2019-01-09T16:22:25.025Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/522458042566:getServerAppConfig  

[debug] [2019-01-09T16:22:25.206Z] <<< HTTP RESPONSE 200
[debug] [2019-01-09T16:22:25.258Z] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:1085:7)
    at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/resolveProjectPath.js:5:17)
    at /usr/local/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:46:36
    at arrayEach (/usr/local/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/local/lib/node_modules/firebase-tools/node_modules/lodash/lodash.js:9344:14)
    at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:29:7)
    at _chain (/usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:22:40)
    at /usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:25:20
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
[error] 
[error] Error: An unexpected error has occurred.

Debug output

Errors in the console logs

N/A

Expected behavior

Project deploys successfully and Cloud Functions can be called

Actual behavior

firebase deploy returns "Error: An unexpected error has occurred."

Most helpful comment

Adding a public/index.html file and "public": "public" property to the hosting section of firebase.json resolved this issue.

All 2 comments

Adding a public/index.html file and "public": "public" property to the hosting section of firebase.json resolved this issue.

Different issue, same error msg because I was missing the --only=hosting:

firebase deploy --only=hosting

And probably it was trying to also deploy storage etc that I have not configured.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

palimad picture palimad  ·  3Comments

nhathiwala picture nhathiwala  ·  4Comments

beratuslu picture beratuslu  ·  4Comments

kaceo picture kaceo  ·  3Comments

artcab picture artcab  ·  4Comments