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.

[gRPC] Error: The includeDirs option must be an array

See original GitHub issue

Issue Description

When I try to use the includeDirs option of @grpc/proto-loader I get the following error:

ERROR: ExecuteHook: protoImport failed
ERROR: Error - The includeDirs option must be an array
Error: The includeDirs option must be an array
	at Object.IZe [as loadProtosWithOptions] (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:84:29203)
	at KZe (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:84:31987)
	at Eae.process (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:126676)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async Iq.trigger (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:76164)
	at async Vp (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:93948)
	at async Lw (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:94554)
	at async zst (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:101698)
	at async Object.iP (/Users/user.name/.vscode/extensions/anweber.vscode-httpyac-4.0.3/dist/extension.js:90:101567)

This is an example of what I’m using:

proto < /Users/user.name/go/my-service/my-service.proto
enums: String,
includeDirs: [ "../../proto/third_party/googleapis" ],

###

GRPC http://localhost:9090/myservice.MyService/GetUser
{
  "userId": "123456",
}

Is it something wrong with my .http file?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
AnWebercommented, Oct 4, 2021

I read over the question:-) Yes it is possible, but in this case not by {{...}} but in template notation. The options are already executed as javascript.

proto < /Users/user.name/go/my-service/my-service.proto
enums: String,
includeDirs: [ `${assetsDir}proto/third_party/googleapis` ],
1reaction
AnWebercommented, Oct 2, 2021

I have now published the changes with version 4.1.0. Please test again and let me know. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GRPC client using with node js facing issue - Stack Overflow
I found the solution to the above error, you need to create a folder inside the project directory googleapis->google->api then need to add ......
Read more >
GrpcClientOptions - google-gax documentation
... if (Array.isArray(filename) && filename.length === 0) { return {}; } const options = GrpcClient.defaultOptions(); options.includeDirs.unshift(protoPath) ...
Read more >
@grpc/proto-loader - npm
Start using @grpc/proto-loader in your project by running `npm i ... includeDirs, An array of strings, A list of search paths for imported ......
Read more >
How to use the protobufjs.Root function in protobufjs - Snyk
includeDirs ) { if (!Array.isArray(options.includeDirs)) { throw new Error('The includeDirs option must be an array'); } addIncludePathResolver(root, options ...
Read more >
google-gax documentation - Google APIs
src/grpc.ts. Index. Properties. equals. Properties. equals. equals: Function. Type : Function. import * as grpcProtoLoader from '@grpc/proto-loader'; ...
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