I'm trying to transpile my project which has some dependencies that are using debug, and I got an error when I try to transpile it with this webpack config :
{
target : "node",
module : {
rules : [{
test : /\.js$/,
loader : "babel-loader",
options : {
babelrc : false,
presets : [
["@babel/preset-env", {
"targets": {
"node": "6.11.2"
}
}]
]
}
}]
}
}
The stacktrace is leading me to "./node_modules/debug/src/node.js" with this error "ReferenceError: init is not defined"
I'm using node.js v12.13.1, with webpack 4.41.5 and babel 7.
Full stacktrace, please
Here you go
Exception while executing function: Functions.routes
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.routes ---> System.AggregateException : One or more errors occurred. ---> ReferenceError: init is not defined
at eval (webpack://handle/./node_modules/debug/src/node.js?:12:16)
at Object../node_modules/debug/src/node.js (D:\home\site\wwwroot\routes\handle.js:7276:1)
at __webpack_require__ (D:\home\site\wwwroot\routes\handle.js:26:30)
at eval (webpack://handle/./node_modules/debug/src/index.js?:8:20)
at Object../node_modules/debug/src/index.js (D:\home\site\wwwroot\routes\handle.js:7265:1)
at __webpack_require__ (D:\home\site\wwwroot\routes\handle.js:26:30)
at eval (webpack://handle/./node_modules/documentdb/lib/log.js?:25:80)
at Object../node_modules/documentdb/lib/log.js (D:\home\site\wwwroot\routes\handle.js:7525:1)
at __webpack_require__ (D:\home\site\wwwroot\routes\handle.js:26:30)
at eval (webpack://handle/./node_modules/documentdb/lib/queryExecutionContext/pipelinedQueryExecutionContext.js?:30:84)
at Object../node_modules/documentdb/lib/queryExecutionContext/pipelinedQueryExecutionContext.js (D:\home\site\wwwroot\routes\handle.js:7669:1)
at __webpack_require__ (D:\home\site\wwwroot\routes\handle.js:26:30)
at eval (webpack://handle/./node_modules/documentdb/lib/queryExecutionContext/proxyQueryExecutionContext.js?:27:38)
at Object../node_modules/documentdb/lib/queryExecutionContext/proxyQueryExecutionContext.js (D:\home\site\wwwroot\routes\handle.js:7681:1)
at __webpack_require__ (D:\home\site\wwwroot\routes\handle.js:26:30)
at eval (webpack://handle/./node_modules/documentdb/lib/queryIterator.js?:27:34)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,CancellationToken cancellationToken)
at EdgeJs.Edge.Func(String code)
at as…
No idea why this wouldn't be working. It works for millions of others every day. Perhaps open a ticket with microsoft? This appears to be their javascript engine.
@Qix- do you think this may be related to documentdb package? 🤔
Unfortunately the package is deprecated https://www.npmjs.com/package/documentdb
Upgrade to @azure/cosmos. Support for documentdb will end on August 30, 2020
@gdepouilly let's fill an issue in https://github.com/Azure/azure-cosmosdb-node and close this one
Honestly, it looks like microsoft's engine doesn't support function hoisting, which is odd since it's part of the javascript specification.
@yvele @gdepouilly Closing for now. Feel free to link back to this issue from the issue you open with Microsoft, for visibility and tracking purposes. :)
Most helpful comment
@yvele @gdepouilly Closing for now. Feel free to link back to this issue from the issue you open with Microsoft, for visibility and tracking purposes. :)