Comments (9)
Thanks for the report, @JoeStanton. At first glance, I'd think it would be something to do with the notifier
section having a null version
field, but we'll look into it.
from bugsnag-node.
I've setup a new lambda server to test this and was able to report errors to bugsnag just fine. Perhaps there is some environment difference that is preventing it from working for you.
Essentially all we are doing to get the version number is:
var path = require('path');
require(path.join(__dirname, '..', 'package.json')).version;
I suppose it's possible that there's a problem with __dirname
?
Can you confirm that __dirname
is working on your lambda server?
from bugsnag-node.
Thanks for looking into this - I've cracked it. As we're transpiling ES6/7, we produce a Webpack bundle that we then use on Lambda. This inlines bugsnag rather than leaving it in node_modules
.
Because your version lookup depends on the directory structure, it fails in this context.
Would you recommend if we're producing a JS bundle that we use the client side JS version of this library?
from bugsnag-node.
No, the client side JS version is only meant to work inside a browser environment. According to this thread you can try listing bugsnag in externals under your webpack config.
If that doesn't work, then maybe we can add something to the library to detect that it is being processed by webpack and require the package.json rather than reading it from disk.
from bugsnag-node.
If we list Bugsnag as a webpack external, users will need to do additional work to ensure this file is shipped next to their bundle and made available by some other means.
IMO it would be preferable to follow your latter suggestion on this? It may be an edge case, but I don't think its safe to assume runtime paths in the age of bundling, and this is non-trivial to debug when it does happen.
Perhaps the easiest solution would be to default the PAYLOAD_VERSION
if it can't be found (or failing that, throw an error and make clear that this is a problem).
from bugsnag-node.
It looks to me as if your patch, @JoeStanton (redbadger@d877e32) is enough to support both standard (non-transpiled) node.js apps, and bundled node.js apps as well. Or am I wrong?
From what I can tell Utils.getPackageVersion
does a simple require
anyway, so there's little to no difference - other than the relative path.
If that's correct, would it not be as simple as merging that patch upstream?
from bugsnag-node.
@jacobmarshall it is indeed sufficient for bundled/non-bundled node apps, however, it assumes the existence of package.json
without a try/catch
. It would be quite odd for this file not to exist, but not sure if this would break someones use case.
from bugsnag-node.
@jacobmarshall it is indeed sufficient for bundled/non-bundled node apps, however, it assumes the existence of package.json without a try/catch. It would be quite odd for this file not to exist, but not sure if this would break someones use case.
Correct, because it's reading the bugsnag-node
package.json
file. Which should always be picked up by the module bundler - in this case webpack.
I'll be honest, it's kind of strange to me that the current code wraps the require
in a try/catch
. I can see that it's always been there (c5aaa5f) - but I'm fairly confident it doesn't need to be there.
I can see now that it's also used to pickup the app's package.json
version if one is not provided in Configuration.appVersion
(https://github.com/bugsnag/bugsnag-node/blob/master/lib/configuration.js#L69). So that explains it 😜
from bugsnag-node.
Hardcoding this value is the simple solution, and the same as other bugsnag libraries. I updated the release instructions as well as the value to ensure it stays up to date.
from bugsnag-node.
Related Issues (20)
- Can't disable logs HOT 3
- Duplicate Error Messages in Logs HOT 1
- Cannot find module backo HOT 2
- Missing functionality or documentation for app type feature HOT 1
- No way to filter authorization header HOT 1
- Middleware crashes with serverless-http HOT 2
- Interface ConfigurationOptions is missing newer Bugsnag options HOT 4
- Source map support HOT 2
- Bugsnag: Error: uv_signal_start EINVAL HOT 9
- not able to minify using create-react-app webpack configuration HOT 7
- Express middleware not sending request details HOT 6
- bugsnag-node depends on "unlicensed" code HOT 2
- Please upgrade `request` dependency to ^2.87.0 HOT 2
- Dependency Bloat HOT 2
- Cannot read property 'startSession' of undefined on test environment HOT 2
- Sessions tracking against `production`, not configured releaseStage HOT 3
- Delivering exception to http://undefined:80undefined HOT 3
- How to add bugsnag middleware to apollo-server-lambda HOT 1
- Sending Strings to bugsnag.notify('String') are ignored HOT 2
- Bugsnag: Encountered an uncaught error, terminating. All uncaught errors force process.exit(), bad. HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bugsnag-node.