resgateio / resgate

A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
https://resgate.io
MIT License
689 stars 67 forks source link

node helloworld fail with "nats.subscribe is not a function" #240

Open antoinetran opened 1 year ago

antoinetran commented 1 year ago

Hi,

Following https://resgate.io/docs/writing-services/01hello-world/ and https://github.com/resgateio/resgate/blob/master/examples/hello-world/server.js, I tried it.

Current symptoms:

node hello-world.js
.../nats/nats-testtools/hello-world.js:3
nats.subscribe('get.example.model', (req, reply) => {
     ^

TypeError: nats.subscribe is not a function
    at Object.<anonymous> (.../nats/nats-testtools/hello-world.js:3:6)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Expected behavior: The hello-world works.

How to reproduce:

npm install nats
node hello-world.js

Env: CentOS 7 node 17.9.1 and 12.18.3 Helm charts: my-nats nats 1 2023-10-19 11:00:57.168363348 +0000 UTC deployed nats-0.19.11 2.9.14-alpine my-resgate nats 3 2023-10-20 11:54:14.393835176 +0000 UTC deployed resgate-0.1.1 1.16.0