Cloud Functions for Firebase - Source Maps

604 views
Skip to first unread message

Jon Pokrzyk

unread,
May 10, 2017, 11:52:55 AM5/10/17
to Firebase Google Group
Does Cloud Functions for Firebase support source maps?

Mads Jon Nielsen

unread,
May 11, 2017, 9:54:52 AM5/11/17
to Firebase Google Group
I've just uploaded a index.js generated with Typescript with "sourceMap": true

I put a exception in there, and the firebase function logging gives me a stacktrace from javascript.

TypeError: Cannot read property 'value' of undefined
    at exports
.now.functions.https.onRequest (/user_code/index.js:5:27)
    at cloudFunction
(/user_code/node_modules/firebase-functions/lib/providers/https.js:26:47)
    at
/var/tmp/worker/worker.js:638:7
    at
/var/tmp/worker/worker.js:622:9
    at _combinedTickCallback
(internal/process/next_tick.js:67:7)
    at process
._tickDomainCallback (internal/process/next_tick.js:122:9)


So i guess not :-D

Consider this a feature request...

cris...@contabilizei.com.br

unread,
Mar 13, 2018, 10:24:18 AM3/13/18
to Firebase Google Group
+1
I would also like this feature

Doug Stevenson

unread,
Mar 13, 2018, 6:30:47 PM3/13/18
to Firebase Google Group
Thanks for chiming in, everyone.  I've filed this as a feature request for Cloud Functions internally.

Doug

justin...@first-rung.com

unread,
Mar 15, 2018, 10:32:48 AM3/15/18
to Firebase Google Group
With source maps enabled put the following at the top of your index.ts

import 'source-map-support/register';

Then you end up with stack traces like this.

Error: Some Error
    at
Error (native)
    at
Object.<anonymous> (/user_code/src/transfers/transfer.ts:49:15)
    at
next (native)
    at
/user_code/dist/transfers/transfer.js:7:71
    at __awaiter
(/user_code/dist/transfers/transfer.js:3:12)
    at exports
.listener.functions.database.ref.onWrite (/user_code/src/transfers/transfer.ts:21:103)
    at
Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:59:27)
    at
next (native)
    at
/user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
    at __awaiter
(/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
    at cloudFunction
(/user_code/node_modules/firebase-functions/lib/cloud-functions.js:53:36)
    at
/var/tmp/worker/worker.js:700:26
    at process
._tickDomainCallback (internal/process/next_tick.js:135:7)



Kamil Wojtczyk

unread,
Mar 15, 2018, 1:00:30 PM3/15/18
to Firebase Google Group
Thank you Justin, that's really helpful!

I ended up using :
import * as sourceMapSupport from 'source-map-support'
sourceMapSupport.install()

because of tslint's no-import-side-effect rule and all works really well.
Reply all
Reply to author
Forward
0 new messages