nats-io / stan.js

Node.js client for NATS Streaming
Apache License 2.0
293 stars 49 forks source link

Invalid publish request for every publish #189

Closed dagenius007 closed 4 years ago

dagenius007 commented 4 years ago

I keep getting invalid publish request after my nats server goes.

kozlovic commented 4 years ago

Please refrain from updating all closed issues from different client libraries and server.

Getting invalid publish when the server is down is expected. Can you describe better your issue?

dagenius007 commented 4 years ago

Sorry about that @kozlovic. The server is not down. I meant after restarting my server.

So I read this from the docs

By default, the NATS Streaming Server stores its state in memory, which means that if the streaming server is stopped, all state is lost. On server restart, since no connection information is recovered, running applications will stop receiving messages and new published messages will be rejected with an invalid publish request error.

I don't if you can help out?

kozlovic commented 4 years ago

So are you running with memory store or file store?

dagenius007 commented 4 years ago

Memory store

kozlovic commented 4 years ago

Well, then as stated in the documentation, it is normal since the restarted server has no state and so your current connection does not exist on this server. You would need to recreate connection (and subscriptions if applicable) or use a server with file store or SQL store: https://docs.nats.io/nats-streaming-server/configuring/persistence