Preview Service - how to test it's working OK


I was wondering how / when the preview service tasks are created. We are hosting on AWS and I’m trying to figure out when the preview jobs are created so I can test the deploy went OK.

Hi ,

The preview jobs are created when a request is made for a preview that doesn’t yet exist.

So making a request https://your-server-url/preview/EXISTING_PUBLIC_STREAM_ID/ should create a job for the previewservice.

Also, inside the previewservice container, when it successfully executes DB queries, even if there are no jobs, it writes a file that can be used for healthchecks: /tmp/last_successful_query.

You can check that the file exist and it contains a timestamp not older than 1h for example (if, for example, a preview generation can take up to 1h for large streams)

In case you are using Kubernetes for the deployment, you can also use the following liveness probe for the previewservice, that uses that file:

          initialDelaySeconds: 60
          periodSeconds: 60
              - node
              - -e
              - process.exit( - require('fs').readFileSync('/tmp/last_successful_query', 'utf8') > 3600 * 1000)
1 Like

Thanks for the quick reply. When requesting https://your-server-url/preview/EXISTING_PUBLIC_STREAM_ID/ does this create a row in the database? Do you know which table?

Yes, in the object_preview table.

previewStatus column might be of interest. Values are:

  • 0: initial state (pending preview generation, set by the server)
  • 1: preview generation in progress (set by the previewservice)
  • 2: preview generated successfully
  • 3: preview generation error
1 Like

Also note that the stream must contain at least one commit with an object, cannot generate previews for empty streams

OK, thanks, that’s clear. I should be able to test it from there


Tested and working. Thanks @cristi for your help.