#community-help

Typesense Key and Data Problems After Server Restart

TLDR Masahiro experienced an issue with Typesense (Docker) on GCE, as the API key and data were lost after server restart. Kishore Nallan and Jason suggested that the issue might be with the Docker container or GCE instance not using a persistent volume, leading to data loss on restart.

Powered by Struct AI
Dec 03, 2021 (26 months ago)
Masahiro
Photo of md5-366dff6b5f9b1a7d0f404fdc3261e573
Masahiro
02:56 AM
Thank you for all your help.
Thanks to Typesense, our team’s development efficiency is very high and it helps us a lot. 😄
By the way, I have a question. Our team is using Typesense (Docker) with GCE. After restarting the instance, I get the error “Request failed with HTTP code 401 | Server said: Forbidden - a valid x-typesense-api-key header must be sent. Why?
I’m looking forward to your reply.
Regards
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:00 AM
👋 may I know what version of TS are you using?

In any case, check that the API key you are sending is actually present by hitting the /keys endpoint.
Masahiro
Photo of md5-366dff6b5f9b1a7d0f404fdc3261e573
Masahiro
03:45 AM
Thanks for the quick reply!
Of course, I’m using v0.21.0.
If I restart the instance, do I need to reconfigure the API key as well?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:48 AM
Did you check /keys?
Masahiro
Photo of md5-366dff6b5f9b1a7d0f404fdc3261e573
Masahiro
03:51 AM
Yes. But it was empty. []
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:53 AM
Hmm. Rest of the data is fine?
03:53
Kishore Nallan
03:53 AM
If it's empty you have to regenerate the keys.
Masahiro
Photo of md5-366dff6b5f9b1a7d0f404fdc3261e573
Masahiro
03:59 AM
Not found.
Is this normal behavior?
Since Typesense stores data in RAM, isn’t it possible that the data is erased after a reboot? When I reboot, the docker container is also exited.
04:00
Masahiro
04:00 AM
initial bootstrap key is fine.
04:01
Masahiro
04:01 AM
Shall I create an issue?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:03 AM
We would need access to the logs. Only keys disappeared but not other data?
04:46
Kishore Nallan
04:46 AM
Masahiro I checked for this type of issue against our support tickets, and the only time I have seen this happen is when people mistakenly connecting to a different cluster.
04:54
Kishore Nallan
04:54 AM
Consolidated list of questions:

a) Only keys were missing but collection data was okay?
b) Do you run Typesense as a single node or as a cluster?
c) When was the last time did you restart the Typesense server?
d) When was the last time did you create/rotate API keys?
e) Can you share the Typesense logs on restart?
Dec 04, 2021 (25 months ago)
Masahiro
Photo of md5-366dff6b5f9b1a7d0f404fdc3261e573
Masahiro
12:18 AM
OK! Here are the answers.
a) data was also lost
b) single node
c) yesterday (Technically speaking, I restarted the GCE instance and restarted the docker container.)
d) yesterday (Initial bootstrap key remained unchanged)
e) Could you please tell me how to get the logs?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:16 AM
Since all data is lost, it's not related to just API keys. This is unlikely to a Typesense related issue.

The docker logs command will print container logs on screen.
Dec 05, 2021 (25 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:02 PM
I suspect the docker container or the GCE instance was not using a persistent volume, which may be got wiped out on restart?

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Troubleshooting Typesense Server Error on Docker

vikram was facing an error with Typesense Server Docker container and loss of data on restart. Kishore Nallan guided to avoid mounting tmp directory from localhost and explained stopping the Docker container.

2

16
14mo

Trouble with Typesense Memory Usage when Restarting Docker Container

Blend reports increased memory usage when restarting Docker with Typesense, information shared with Jason and Kishore Nallan. Potential data edge case identified as potential cause, although resolution undetermined.

9

45
12mo

Troubleshooting Local Authentication Issue in Typesense

Todd reported consistent issues with local authentication, leading to requests failing. Kishore Nallan suggested checking the server logs. This revealed Todd was using an incorrect API key. The issue resolved by itself, although somewhat mysteriously.

1

6
2mo

Debugging Typesense API Key Error

James is getting an error related to the `x-typesense-api-key` header in their Typesense project. Harrison suggests passing the API key in the HTTP header, and Jason advises checking the key via curl and possibly closing a duplicate Typesense server.

1

15
24mo

Deploying Typesense in GCP Cloud Run

Christian had difficulties obtaining an API key for deploying Typesense in GCP Cloud Run. Kishore Nallan guided on API key creation when setting up Typesense server and suggested checking the Typesense self-hosting guide. Christian decided to run the Typesense in Kubernetes instead of Cloud Run. Nasim thanked Christian for sharing findings.

1

20
19mo