Firebase-functions: Error while deploying to emulator: RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range.

Created on 20 May 2018  路  3Comments  路  Source: firebase/firebase-functions

Error while deploying to emulator: RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453

Version info

firebase-functions:
latest

firebase-tools:
latest

firebase-admin:
latest

firebase --version
3.18.4

functions --version
Warning: You're using Node.js v10.1.0 but Google Cloud Functions only supports v6.11.5.
1.0.0-beta.4

node --version
v10.1.0

npm --version
6.0.1

OS
Windows 7 x64

Test case

Used typescript to produce a JS as Doug advices in one of its videos.
No problem, JS generated perfectly.

But when I try to serve, the functions emulator fails to emulate my _api_ endpoint and generates an _out of range_ error.

Typing:

C:\Program Files\nodejs\project\functions>firebase serve --only functions --debug

Ends with:

[2018-05-19T23:29:44.130Z] Error while deploying to emulator: RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453
RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453
at checkInt (internal/buffer.js:35:11)
at writeU_Int32LE (internal/buffer.js:515:3)
at Buffer.writeInt32LE (internal/buffer.js:684:10)
at Object.entryHeaderToBinary (C:\Program Files\nodejs\project\node_modules\adm-zip\headers\entryHeader.js:216:18)
at Object.packHeader (C:\Program Files\nodejs\project\node_modules\adm-zip\zipEntry.js:260:39)
at C:\Program Files\nodejs\project\node_modules\adm-zip\zipFile.js:198:41
at Array.forEach ()
at Object.compressToBuffer (C:\Program Files\nodejs\project\node_modules\adm-zip\zipFile.js:182:23)
at Object.writeZip (C:\Program Files\nodejs\project\node_modules\adm-zip\adm-zip.js:454:32)
at client.generateUploadUrl.then.then (C:\Program Files\nodejs\project\node_modules@google-cloud\functions-emulator\src\cli\controller.js:168:13)
! functions: Failed to emulate api

Full log:

C:\Program Files\nodejs\project\functions>firebase serve --only functions --debug
[2018-05-19T23:29:38.959Z] ----------------------------------------------------------------------
[2018-05-19T23:29:38.962Z] Command: C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\project\node_modules\firebase-tools\bin\firebase serve --only functions --debug
[2018-05-19T23:29:38.963Z] CLI Version: 3.18.4
[2018-05-19T23:29:38.963Z] Platform: win32
[2018-05-19T23:29:38.963Z] Node Version: v10.1.0
[2018-05-19T23:29:38.963Z] Time: Sun May 20 2018 01:29:38 GMT+0200 (Paris, Madrid (heure d鈥櫭﹖茅))
[2018-05-19T23:29:38.963Z] ----------------------------------------------------------------------

(node:14048) ExperimentalWarning: The fs.promises API is experimental
[2018-05-19T23:29:38.978Z] > 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"]
[2018-05-19T23:29:38.978Z] > authorizing via signed-in user
[2018-05-19T23:29:38.981Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/project-11b1e

Sun May 20 2018 01:29:38 GMT+0200 (Paris, Madrid (heure d鈥櫭﹖茅))
[2018-05-19T23:29:39.654Z] <<< HTTP RESPONSE 200 server=nginx, date=Sat, 19 May 2018 23:29:41 GMT, content-type=application/json; charset=utf-8, content-length=114, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-05-19T23:29:39.656Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/project-11b1e/tokens

Sun May 20 2018 01:29:39 GMT+0200 (Paris, Madrid (heure d鈥櫭﹖茅))
[2018-05-19T23:29:40.228Z] <<< HTTP RESPONSE 200 server=nginx, date=Sat, 19 May 2018 23:29:42 GMT, content-type=application/json; charset=utf-8, content-length=264, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-05-19T23:29:40.229Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/project-11b1e

Sun May 20 2018 01:29:40 GMT+0200 (Paris, Madrid (heure d鈥櫭﹖茅))
[2018-05-19T23:29:40.958Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 19 May 2018 23:29:42 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35", accept-ranges=none, connection=close

=== Serving from 'C:\Program Files\nodejs\project'...

i functions: Preparing to emulate functions.
[2018-05-19T23:29:41.596Z] Fetching environment
[2018-05-19T23:29:41.598Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/300108879366:getServerAppConfig

Sun May 20 2018 01:29:41 GMT+0200 (Paris, Madrid (heure d鈥櫭﹖茅))
[2018-05-19T23:29:42.094Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 19 May 2018 23:29:44 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35", accept-ranges=none, connection=close
[2018-05-19T23:29:42.094Z] Starting 
Warning: You're using Node.js v10.1.0 but Google Cloud Functions only supports v6.11.5.
[2018-05-19T23:29:43.615Z] Parsing function triggers
[2018-05-19T23:29:44.130Z] Error while deploying to emulator: RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453
RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453
at checkInt (internal/buffer.js:35:11)
at writeU_Int32LE (internal/buffer.js:515:3)
at Buffer.writeInt32LE (internal/buffer.js:684:10)
at Object.entryHeaderToBinary (C:\Program Files\nodejs\project\node_modules\adm-zip\headers\entryHeader.js:216:18)
at Object.packHeader (C:\Program Files\nodejs\project\node_modules\adm-zip\zipEntry.js:260:39)
at C:\Program Files\nodejs\project\node_modules\adm-zip\zipFile.js:198:41
at Array.forEach ()
at Object.compressToBuffer (C:\Program Files\nodejs\project\node_modules\adm-zip\zipFile.js:182:23)
at Object.writeZip (C:\Program Files\nodejs\project\node_modules\adm-zip\adm-zip.js:454:32)
at client.generateUploadUrl.then.then (C:\Program Files\nodejs\project\node_modules@google-cloud\functions-emulator\src\cli\controller.js:168:13)
! functions: Failed to emulate api

Looks like some timestamp problem, or bigint boundary failure (Windows 7 x64 ?). Or it may be incompability between modules, don't know.

Tried to delete node_modules then reinstall but, nope, same error.

Steps to reproduce

firebase serve --only functions --debug

Were you able to successfully deploy your functions?

Yes, no problem.
Functions succesfully deployed.

Expected behavior

Firebase functions emulator is expected to work.

It is critical for developers to be able to test external calls (outside Google network), like Stripe payments, at free cost, before going to production with a billed infrastructure.

Even for devs that already have a non-free plan, the emulator is important to be able to perform tests faster.

Actual behavior

Firebase functions emulator does not work and ends with an error:

Error while deploying to emulator: RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received 2185921453

Most helpful comment

The Cloud Functions emulator doesn't work with node 10 currently.

https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/205

All 3 comments

The Cloud Functions emulator doesn't work with node 10 currently.

https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/205

there's a hacky work-around here: https://github.com/firebase/firebase-tools/issues/770

Fixed by the workaround.

https://github.com/firebase/firebase-tools/issues/770#issuecomment-390622784

Thanks for pointing me this !

Was this page helpful?
0 / 5 - 0 ratings