Meilisearch not reachable
We use meilisearch in different envs, but it only works in our local env, not in development for example. I tried everythin already. I moved it to another zone, I tried private and public urls. I also tried to connect from my dev to local env, didn't work either. I experienced lately that when I launch a service and it automatically starts in all envs, it is only available in the env where I started it. I could delete the whole service, but apparently it says that it is going to delete every service instance of it in any env.
The Error:
Please help, my app is supposed to go to alpha testround today 🙂
69 Replies
Project ID:
32a99781-62bd-4751-b019-02237bc18552
32a99781-62bd-4751-b019-02237bc18552
the service that you are trying to connet to melisearch from, is it built with an dockerfile that uses alpine?
it is a golang service. I dont build a docker manually, it is automatically built by railway.
are you using railway's meilisearch template?
Correct!
show the meilisearch client go code please
You mean how I connect from go?
Will do, but it works on my other environment
thats why I would not think it is an implementation problem
this is how i get the searchclient
does it print the variable?
will check again
give me a sec
It does
2nd line
at what point in your apps lifecycle does that function run?
Everytime I make a call to meilisearch.
As I said, it is working on the other environment completely, thats why I dont think that this is a code issue
the variable may print, but it that the correct domain according to the one listed in the meilisearch's settings
have you tried with the public url?
will try again, did, but lets see
and side question, can you call meilisearch's public address directly? locally
same error. I can get onto the ui, since it is in development mode.
so, I can see it when I use the public url.
same error when using the public url?
Correct
Actually this has to be a connection issue within railway.
can you do some simple lookups in an init function?
like?
u have example code?
then I can push to develop Gore But I am owner so dont care.
not on hand, it's just standard library stuff though
what kind of lookup?
like ping an address?
a DNS lookup on the meilisearch url
will do like this:
for public and private url
looks good to me, just dont assume the answer will be an A type, the internal domains will resolve to AAAA types
it is building
back in 5
Gives me this
(EXTRA string=34.32.135.56)meilisearch-development-xxxx.up.railway.app
xxxx is placeholder
okay that is the public ip, looks good to me. what about the private
when doing a lookup on the private domain make sure you add a 3 second sleep before the lookup
EXTRA string=fd12:64a2:cf2c:0:4000:1:eb1b:cc6a)meilisearch.railway.internal
this is internal?
yep that's an ipv6 address
So this is correct?
so there's nothing wrong with the lookups, that makes it incredibly unlikely to be a railway issue
that is really really strange. What I will do now is, I will delete the service completely from withtin dev env, then recreate a new service from within dev and lets see if it then works, that would be really interesting. cause i noticed the same issue with postgres before. I always had to delete the service in each env where it was created automatically and manually create a new one, after that everything worked as expected. Let me check.
going forward, for good measure add a 3 second sleep to the beginning of your start command
you mean before the meili client is instantiated?
if you think you can work that out properly then yes, otherwise add the sleep to the start command itself
well since the meiliclient will only be instantiated when i make an api call to a search endpoint, I can manually control the time before i execute this.
you only need a single 3 second sleep to delay the starting of the entire app, that's why I'm recommending adding the sleep to the start command
Same Error.
do you have a 3 second sleep in the start command?
how shall i add it?
with the ui from railway?
change your start command to include a
sleep 3
U mean here?
yes
So?
you need to join then with
&&
sleep 3 && bin/api
yes
LOL
Ur sentence confused me hard 😄
Same FML
is railway using the new start command with a sleep in it? check the build table
This is the calling code
There is nothing special in it. It should work out of the fckn box
your error
lookup : no such host
is incomplete, it should at least read something like this https://utilities.up.railway.app/dns-lookup?value=non-existent.railway.internal&type=ip
your error is missing the host and dns resolver, mine isnt
so somewhere in your code or some package you are using, something is going wrongWill print the error in place now with err.Error()
to be sure that the info is maybe lost on the propagation part.
Okay I have a question then, why does it work in other environments?
no clue
but you have proven that you can indeed successfully lookup both the public and private domains, if this was an issue with railway those lookups would have failed
Does not make sense to me, it should error out on the other env too.
code issues aren't always going to make sense
true, but still it does bother me, there is one difference from the local to dev env.
will test this.
U cant be serius
fml
on the local env in railway i have prefixed the public url with https, this works then
also for the dev env
does that make any sense to u?
not really
😄
but actually I want to use the internal url for better performance or doesnt the public url go first out of the network and then back in?
and It will up the costs I think as well
using the public url would have more hops, yes, and you would be subjecting yourself to egress fees.
you do want to use the private url, and for clarity sake when using an internal domain your scheme would be http and not https
redeploying and checking
Could one issue be, that my service starts here:
Port is 3001
do you have any issues accessing the service itself?
My service, the golang one?
No, this works just fine.
then there wouldn't be an issue with that line if you can access the service itself just fine