Skip to content

cloud functions deploy fails if using latest firebase-admin #122

@Maistho

Description

@Maistho

Version info

firebase-functions: 0.7.1

firebase-tools: 3.13.1

firebase-admin: 5.4.2

Test case

See master for non-working, see the branch fix for a working deploy
https://github.com/maistho/firebase-functions-deploy-error

Steps to reproduce

  1. Create a new repo
  2. initialize with firebase init
  3. choose functions
  4. uncomment the hello world function
  5. add a main entry to functions/package.json
  6. run firebase deploy

Workaround

change the version of firebase-admin to ~5.2.1
now it works for some reason.

Were you able to successfully deploy your functions?

No, see below

Expected behavior

Functions should be able to deploy

Actual behavior

$ firebase deploy --debug
[2017-10-19T00:14:43.215Z] ----------------------------------------------------------------------
[2017-10-19T00:14:43.218Z] Command:       /usr/bin/node /home/maistho/prog/test-firebase/node_modules/.bin/firebase deploy --debug
[2017-10-19T00:14:43.218Z] CLI Version:   3.13.1
[2017-10-19T00:14:43.218Z] Platform:      linux
[2017-10-19T00:14:43.218Z] Node Version:  v8.7.0
[2017-10-19T00:14:43.219Z] Time:          Thu Oct 19 2017 02:14:43 GMT+0200 (CEST)
[2017-10-19T00:14:43.219Z] ----------------------------------------------------------------------

[2017-10-19T00:14:43.226Z] > 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"]
[2017-10-19T00:14:43.226Z] > authorizing via signed-in user
[2017-10-19T00:14:43.228Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/user-permissions-test  
 Thu Oct 19 2017 02:14:43 GMT+0200 (CEST)
[2017-10-19T00:14:43.910Z] <<< HTTP RESPONSE 200 server=nginx, date=Thu, 19 Oct 2017 00:14:45 GMT, content-type=application/json; charset=utf-8, content-length=138, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2017-10-19T00:14:43.911Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/user-permissions-test/tokens  
 Thu Oct 19 2017 02:14:43 GMT+0200 (CEST)
[2017-10-19T00:14:44.601Z] <<< HTTP RESPONSE 200 server=nginx, date=Thu, 19 Oct 2017 00:14:46 GMT, content-type=application/json; charset=utf-8, content-length=272, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
1

=== Deploying to 'user-permissions-test'...

i  deploying functions
[2017-10-19T00:14:45.854Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "dependencies": {
    "firebase-admin": "~5.4.0",
    "firebase-functions": "^0.7.0"
  },
  "main": "index.js",
  "private": true
}
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
[2017-10-19T00:14:45.855Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/user-permissions-test?view=CONSUMER_VIEW  
 Thu Oct 19 2017 02:14:45 GMT+0200 (CEST)
[2017-10-19T00:14:45.855Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/user-permissions-test?view=CONSUMER_VIEW  
 Thu Oct 19 2017 02:14:45 GMT+0200 (CEST)
[2017-10-19T00:14:46.987Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:49 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
✔  runtimeconfig: all necessary APIs are enabled
[2017-10-19T00:14:47.015Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:49 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
✔  functions: all necessary APIs are enabled
[2017-10-19T00:14:47.016Z] >>> HTTP REQUEST GET https://appengine.googleapis.com/v1/apps/user-permissions-test  
 Thu Oct 19 2017 02:14:47 GMT+0200 (CEST)
[2017-10-19T00:14:47.016Z] >>> HTTP REQUEST GET https://apikeys.googleapis.com/v1/projects/user-permissions-test/apiKeys  
 Thu Oct 19 2017 02:14:47 GMT+0200 (CEST)
[2017-10-19T00:14:47.874Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:50 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:14:47.955Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:50 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
i  functions: preparing functions directory for uploading...
[2017-10-19T00:14:48.437Z] >>> HTTP REQUEST GET https://runtimeconfig.googleapis.com/v1beta1/projects/user-permissions-test/configs  
 Thu Oct 19 2017 02:14:48 GMT+0200 (CEST)
[2017-10-19T00:14:49.300Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:51 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
i  functions: packaged functions (26.76 KB) for uploading
[2017-10-19T00:14:50.146Z] >>> HTTP REQUEST GET https://www.googleapis.com/storage/v1/b/staging.user-permissions-test.appspot.com  
 Thu Oct 19 2017 02:14:50 GMT+0200 (CEST)
[2017-10-19T00:14:50.350Z] <<< HTTP RESPONSE 200 x-guploader-uploadid=AEnB2Uq_8Wy8y1GEFEgWMSTBWZTPHlUlw00J2sQLRRFV4sUsfJCdwO2097ETQR_9FzJ6uw8szWsv8wuQgmOdow31iOVGuFam7A, etag=CAE=, vary=Origin, X-Origin, content-type=application/json; charset=UTF-8, expires=Thu, 19 Oct 2017 00:14:52 GMT, date=Thu, 19 Oct 2017 00:14:52 GMT, cache-control=private, max-age=0, must-revalidate, no-transform, content-length=572, server=UploadServer, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", connection=close
[2017-10-19T00:14:50.351Z] >>> HTTP REQUEST POST https://www.googleapis.com/upload/storage/v1/b/staging.user-permissions-test.appspot.com/o?uploadType=media&name=firebase-functions-source ReadStream {
  _readableState: 
   ReadableState {
     objectMode: false,
     highWaterMark: 65536,
     buffer: BufferList { head: [Object], tail: [Object], length: 1 },
     length: 27402,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: true,
     endEmitted: false,
     reading: false,
     sync: false,
     needReadable: false,
     emittedReadable: true,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: { end: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  path: '/tmp/firebase-functions-29017qzQBeE1XuVkD.zip',
  fd: 15,
  flags: 'r',
  mode: 438,
  start: undefined,
  end: undefined,
  autoClose: true,
  pos: undefined,
  bytesRead: 27402 } 
 Thu Oct 19 2017 02:14:50 GMT+0200 (CEST)
[2017-10-19T00:14:50.822Z] <<< HTTP RESPONSE 200 x-guploader-uploadid=AEnB2Uq5XCwm1yoj5KdZFBq1h0oA4Z10Bz6p6dpyFFTZdTPF11YiT_a2_nalkCkWVVNMaIHkYvIdJJDSWUWudjjA3Nbos6vv6RTO_4sq27yz-lPIcbdtsaE, etag=COGDrfaz+9YCEAE=, vary=Origin, X-Origin, content-type=application/json; charset=UTF-8, cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, expires=Mon, 01 Jan 1990 00:00:00 GMT, date=Thu, 19 Oct 2017 00:14:53 GMT, content-length=892, server=UploadServer, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", connection=close
✔  functions: functions folder uploaded successfully
i  starting release process (may take several minutes)...
[2017-10-19T00:14:50.823Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/projects/user-permissions-test/locations/us-central1/functions  
 Thu Oct 19 2017 02:14:50 GMT+0200 (CEST)
[2017-10-19T00:14:51.304Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:53 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
i  functions: updating function helloWorld...
[2017-10-19T00:14:51.306Z] Trigger is:  
[2017-10-19T00:14:51.307Z] >>> HTTP REQUEST PUT https://cloudfunctions.googleapis.com/v1beta2/projects/user-permissions-test/locations/us-central1/functions/helloWorld { sourceArchiveUrl: 'gs://staging.user-permissions-test.appspot.com/firebase-functions-source',
  name: 'projects/user-permissions-test/locations/us-central1/functions/helloWorld',
  entryPoint: 'helloWorld',
  timeout: '60s',
  availableMemoryMb: 256,
  httpsTrigger: {} } 
 Thu Oct 19 2017 02:14:51 GMT+0200 (CEST)
[2017-10-19T00:14:51.743Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:54 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:14:51.744Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/projects/user-permissions-test/locations/us-central1/functions  
 Thu Oct 19 2017 02:14:51 GMT+0200 (CEST)
[2017-10-19T00:14:51.744Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:14:51 GMT+0200 (CEST)
[2017-10-19T00:14:52.135Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:54 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:14:52.135Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is not done.
[2017-10-19T00:14:52.241Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:54 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:14:57.141Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:14:57 GMT+0200 (CEST)
[2017-10-19T00:14:57.357Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:14:59 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:14:57.358Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is not done.
[2017-10-19T00:15:02.359Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:15:02 GMT+0200 (CEST)
[2017-10-19T00:15:02.812Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:15:05 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:15:02.812Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is not done.
[2017-10-19T00:15:07.816Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:15:07 GMT+0200 (CEST)
[2017-10-19T00:15:08.183Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:15:10 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:15:08.183Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is not done.
[2017-10-19T00:15:13.189Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:15:13 GMT+0200 (CEST)
[2017-10-19T00:15:13.586Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:15:15 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:15:13.586Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is not done.
[2017-10-19T00:15:18.588Z] >>> HTTP REQUEST GET https://cloudfunctions.googleapis.com/v1beta2/operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ  
 Thu Oct 19 2017 02:15:18 GMT+0200 (CEST)
[2017-10-19T00:15:19.180Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 19 Oct 2017 00:15:21 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close
[2017-10-19T00:15:19.183Z] [functions] operation poll: helloWorld: update operations/dXNlci1wZXJtaXNzaW9ucy10ZXN0L3VzLWNlbnRyYWwxL2hlbGxvV29ybGQvUFRxMEFZWHpVcTQ is done.
⚠  functions[helloWorld]: Deploy Error: Function load error: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'firebase-admin'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/apps.js:25:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)


Functions deploy had errors. To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.

Having trouble? Try firebase deploy --help

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions