Search code examples
google-cloud-platformgoogle-cloud-spanner

Google Cloud Spanner Session not found


I have an error when i call my spanner dev instance after 1 or 2 hours. Without a call.

Error: Session not found: xxxx/xxxxx/xxxxx

I have current spanner node.js client installed and the newest grpc package. Is it required to hold the connection open with a keep alive call?

Thank you


Solution

  • Google Cloudspanner sessions can automatically be closed by Google if being idle for a while: https://cloud.google.com/spanner/docs/sessions#keep_an_idle_session_alive

    Doing a simple keep alive query like SELECT 1 every now and then is all you need.