question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'hasOwnProperty' of null

See original GitHub issue

Attempting to use this plugin with grpc-tools from grpc-node package:

protoc \
  --proto_path=proto/schemas \
  --plugin=protoc-gen-grpc="$(which grpc_node_plugin)" \
  --js_out=import_style=commonjs,binary:proto/js \
  --ts_out="proto/js" \
  --grpc_out=grpc_js:proto/js \
  ./proto/schemas/*.proto

Results in:

/home/cmcdragonkai/Projects/js-polykey/node_modules/typescript/lib/typescript.js:12449
        return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
                     ^

TypeError: Cannot read property 'hasOwnProperty' of null
    at Object.isNodeArray (/home/cmcdragonkai/Projects/js-polykey/node_modules/typescript/lib/typescript.js:12449:22)
    at createNodeArray (/home/cmcdragonkai/Projects/js-polykey/node_modules/typescript/lib/typescript.js:20812:25)
    at Object.createCallExpression (/home/cmcdragonkai/Projects/js-polykey/node_modules/typescript/lib/typescript.js:22099:95)
    at Object.createCall (/home/cmcdragonkai/Projects/js-polykey/node_modules/typescript/lib/typescript.js:3022:29)
    at createToObject (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:49:14)
    at createMessage (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:1016:5)
    at processMessageDescriptor (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:1545:5)
    at processProtoDescriptor (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:1590:12)
    at main (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:1680:24)
    at Object.<anonymous> (/home/cmcdragonkai/Projects/js-polykey/node_modules/protoc-gen-ts/index.js:1765:1)
--ts_out: protoc-gen-ts: Plugin failed with status code 1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
thesayyncommented, Apr 7, 2021

Hey @paul-pop. I’ll try to release it today.

1reaction
thesayyncommented, Jan 25, 2021

Hey @CMCDragonkai. in lock file we have ^3.8.3 and i think it ought to work with 4.x.x.

But we have something else to fix here. as far as i can see that you are trying to use this with other plugins. I guess you understood the plugin wrong. You don’t need any other JS related plugins if you are using this plugin.

so instead of you way you should use it like this;

protoc --proto_path=proto/schemas --ts_out="proto/ts" ./proto/schemas/*.proto

it will generate everything to the ‘proto/ts’ directory. you can import those files and they are ready to use. keep in mind that in that directory theres .ts files instead of .d.ts files which means they contain all the necessary runtime code to run. I would like assist you further if you can’t get out of this situation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'hasOwnProperty ...
The syntax for this is label. on('selected', functionToCall()); This works fine when I make the function an anonymous inner function, but when ...
Read more >
Cannot read property 'hasOwnProperty' of undefined - Codeless
Hi there, I am getting an error Cannot read property 'hasOwnProperty' of undefined which I cannot identify or replicate.
Read more >
[BUG] Cannot read property 'hasOwnProperty' of null #8948
Suddendly, generally after a lot of positive queries, i get this exception: TypeError: Cannot read property 'hasOwnProperty' of null 0|CDS ...
Read more >
TypeError: Cannot read property 'hasOwnProperty' of null
Hi i got this error, i was using flex like for 2 months, and now i got this error, any one have a...
Read more >
TypeError: Cannot read property 'hasOwnProperty' - Laracasts
Cannot read property 'hasOwnProperty' of undefined. This means that this.errors is not defined. Are you sure this.errors has a value? Or a default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found