source map support?
Is it possible to have functions use a source map (like index.js.map) so that line number in stack traces make more sense when using TypeScript?
I believe all that is needed is to request sourcemaps in your tsconfig.json like so:
"compilerOptions": {
"sourceMap": true
}
Does that address your issue, or are the sourcemaps still not being respected?
Sorry I wasn't clear. Yes, the above does not work. Source maps are generated of course, but line numbers in the stack traces for errors don't match up to the original typescript code.
Thanks for clarifying! Can you tell me a bit more about your situation, so we can reproduce this issue?
Does it happen locally when running with the functions-framework CLI, or just when deploying to GCF? Are you using the gen1 or gen2 runtime environment in GCF?
I'll continue investigating, but the more information you can provide, the better. Thanks!
Just deploy a typescript function that simply throws an error. Look at the line numbers of that error in the google logs. The line numbers are wrong, they don't match the typescript code - they match the generated JS code. I don't think you need an example, the write a basic http trigger function with throw new Error() as the body
@npomfret Thanks and will be taking this into consideration in our planning. Closing out as this does not indicate a sample error or issue and that there is a path for debugging through the generated js sample code (from the ts sample).