#community-help

Schema Config Issue With Typesense Hosted on Render

TLDR Matthias had issues with a schema config on Typesense hosted on Render. Joshua helped troubleshoot, and Matthias resolved the issue by using the external URL.

Powered by Struct AI

1

24
25mo
Solved
Join the chat
Oct 11, 2021 (25 months ago)
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:21 PM
Help! Is there something wrong with this schema config:
{
  "name": "content-schemas",
  "fields": [
    {
      "name": "typesenseSchema",
      "type": "string",
      "facet": false,
      "index": true,
      "optional": false
    },
    {
      "name": "schema",
      "type": "string",
      "facet": false,
      "index": true,
      "optional": false
    }
  ]
}

I'm getting an 404 (Request failed with HTTP code 404) error but I can't seem to figure out whats wrong here. Thanks in advance!
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:46 PM
Matthias i tested this locally and it created the schema ok...running typesense v0.21.0 on ubuntu 20.04
03:46
Joshua
03:46 PM
how are you calling the creation of this collection?
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:47 PM
Like this:
  let schema: CollectionCreateSchema = {
    name: collectionName,
    fields: [
      {
        name: 'typesenseSchema',
        type: 'string',
        facet: false,
        index: true,
        optional: false,
      },
      {
        name: 'schema',
        type: 'string',
        facet: false,
        index: true,
        optional: false,
      },
    ],
  };

  try {
    await typesense.collections().create(schema);
    console.log('SETUP: Collection ' + collectionName + ' was created.');
  } catch (error) {
    console.log('SETUP: Error while creating schema collection. Error:', error);
  }
03:48
Matthias
03:48 PM
typesense is a Typesense.Client({...})
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:49 PM
yeah, i'm using python, that's the only difference between your code and mine
03:49
Joshua
03:49 PM
are you able to make calls to typsense via curl?
03:49
Joshua
03:49 PM
curl ""

Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:50 PM
Yes. The code even works locally. But when hosted this error occurs.
03:50
Matthias
03:50 PM
I just can't seem to figure out whats wrong, because this error means that the client reaches the server correctly, right?
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:51 PM
yep, getting a 404 means it's hitting an endpoint

is this using typesense's cloud or your own hosted version somewhere else?
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:52 PM
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:55 PM
are you able to make any calls to this hosted typesense via curl? i'm thinking it's a config issue
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:56 PM
Yes, everything works fine using curl. It's really weird.
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:57 PM
you can create the collection via curl too?
03:58
Joshua
03:58 PM
curl to typesense on render
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:58 PM
yes, I just tried that. Everything seems to work. I can even list it.
03:58
Matthias
03:58 PM
Yes correct, the hosted version on Render.com
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
03:58 PM
:thinking_face:
03:58
Joshua
03:58 PM
where does your javascript run that creates the collection?
Matthias
Photo of md5-8ac455f6d302407f03def4c775778b28
Matthias
03:59 PM
But yes, it's probably something really simple that I messed up that has nothing to do with typesense...
03:59
Matthias
03:59 PM
It's part of a build script for another service that indexes existing DB entries
04:00
Matthias
04:00 PM
I'm currently trying the good old "delete the service and create an new one"-trick

1

04:19
Matthias
04:19 PM
Okay, I fixed it using the external url instead of render.com's internal routing. Seems to be a Render issue. Thanks for helping anyways!
Joshua
Photo of md5-fc2280639a535856f901b06b4928137a
Joshua
04:30 PM
very good 😺