{"id":48036,"library":"grpc-js-consul","title":"grpc-js-consul","description":"A gRPC name resolver for @grpc/grpc-js that integrates with HashiCorp Consul service discovery. Version 1.3.1 is current; release cadence is irregular. It resolves service endpoints from Consul and watches for changes. Differentiators: minimal API (single register() call), supports Consul health checks, tagging, and advanced query parameters (wait, near, limit, stale, consistent). Note: not production-ready per the author; may break backward compatibility.","status":"active","version":"1.3.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install grpc-js-consul","lang":"bash","label":"npm"},{"cmd":"yarn add grpc-js-consul","lang":"bash","label":"yarn"},{"cmd":"pnpm add grpc-js-consul","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for gRPC client","package":"@grpc/grpc-js","optional":false}],"imports":[{"note":"Register is a named export, not default. ESM or CJS both work.","wrong":"import register from 'grpc-js-consul'","symbol":"register","correct":"import { register } from 'grpc-js-consul'"},{"note":"Resolver class is exported from the main package, not a subpath. No types exported separately.","wrong":"import { Resolver } from 'grpc-js-consul/resolver'","symbol":"Resolver","correct":"import { Resolver } from 'grpc-js-consul'"},{"note":"CommonJS users must destructure the named export; there is no default export.","wrong":"const register = require('grpc-js-consul').default","symbol":"register function","correct":"const { register } = require('grpc-js-consul')"}],"quickstart":{"code":"import { credentials } from '@grpc/grpc-js';\nimport { register } from 'grpc-js-consul';\n// Register the Consul resolver\nregister();\n// Now you can use 'consul://' URIs in gRPC client construction\nconst client = new SomeClient('consul://localhost:8500/my-service', credentials.createInsecure());\nclient.someMethod({}, (err, response) => {\n  if (err) console.error(err);\n  else console.log(response);\n});","lang":"typescript","description":"Shows how to register the Consul resolver and create a gRPC client using a consul:// URI."},"warnings":[{"fix":"Pin exact version and thoroughly test upgrades.","message":"Library is not production-ready; may break backward compatibility between versions.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure consul://host:port/service-name?parameters format. See README for supported options.","message":"Consul connection string must be formatted correctly; missing parameters can cause silent failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use main package import: import { register } from 'grpc-js-consul'.","message":"The old import path 'grpc-js-consul/build' may be removed in future versions.","severity":"deprecated","affected_versions":">=1.0 <=1.3"},{"fix":"Use strings like '10s', '5m', '1h30m'.","message":"Verbs like 'wait' and 'timeout' use Go's time.ParseDuration format, not ISO 8601.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.3.1':19 'advanc':48 'api':38 'author':63 'backward':66 'break':65 'cadenc':23 'call':41 'chang':35 'check':45 'compat':67 'consist':55 'consul':4,15,31,43 'current':21 'differenti':36 'discoveri':17 'endpoint':29 'grpc':2,6 'grpc-js-consul':1 'grpc/grpc-js':10 'hashicorp':14 'health':44 'integr':12 'irregular':25 'javascript':68 'js':3 'limit':53 'may':64 'minim':37 'name':7 'near':52 'note':56 'paramet':50 'per':61 'product':59 'production-readi':58 'queri':49 'readi':60 'regist':40 'releas':22 'resolv':8,27 'servic':16,28 'singl':39 'stale':54 'support':42 'tag':46 'typescript':69 'version':18 'wait':51 'watch':33","created_at":"2026-06-07T16:54:36.132569+00:00","updated_at":"2026-06-07T16:54:36.132569+00:00","problems":[{"fix":"Use const { register } = require('grpc-js-consul');","cause":"Trying to use require() with a default import or wrong destructuring.","error":"TypeError: grpc-js-consul.register is not a function"},{"fix":"Call register() at the top of your application.","cause":"register() not called before client creation.","error":"Error: No resolver found for consul://..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"grpc-js-consul","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}