-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toJSON: Cannot read property 'prototype' of null at Function.toObject #730
Comments
Currently, generated code aims to remain compatible with any configuration (with or without long.js), in case it is shared or otherwise depended upon by another application. |
That's fine; what's the story with $util.Long being undefined? |
Looks like long.js isn't present. You can check this by evaluating protobuf.util.Long = require("long");
protobuf.configure(); |
long.js is present; I can do what you suggest, but why is it not being picked up automatically? |
For reference, this is about how the process works:
Referring to the error you see: Long conversion to strings is available with long.js only. Conversion to (a possibly unsafe) number should work even if long.js isn't present. |
When calling MessageObject.toJSON(), I get the following error:
Which occurs in this function:
This code was generated with
--strict-long
, so I'm not really sure whyutil.Long
is undefined, or why any of the code paths above need to be guarded withif ($util.Long) {
.The text was updated successfully, but these errors were encountered: