I am working in an existing network of docker containers. And to make communication between containers easier we have chosen to give network-aliases to each container. Now the problem I am having is that a URL might look like this: http://boefje:8000
and then when I do a request with node-fetch
I will get an TypeError [ERR_INVALID_URL]
error because an url like this should not exist.
I do know that this request would work because when I do execSync(`curl --request GET --url ${input_url} -s`)
(execSync
is from the library child-process) it runs successfully.
I have tried using axios
and http
/https
and I am getting the same issue. I am tempted to use execSync
with curl
but this looks too hacky.
Is there a better solution available for me without having to switch languages?