Having a problem I'm bashing my head at - I have a GET request with the Crystal HTTP client, which runs on my machine, and also on the compiling container - crystallang/crystal, gets a good response and does its job.
But moving the same binary to any other environment (alpine / ubuntu) it just won't, and the exception doesn't make sense to me; I'm getting a weird "No address found for api.example.com:443 over TCP (Socket::Error)" Can't figure what I'm doing wrong. Tried adding ca-certificates and even copying the entire ssl dir to my container. No luck... Here's the code:
def createTag(vtag)
if vtag.key.empty? || vtag.application.empty? || vtag.subsystem.empty? || vtag.name.empty?
raise PluginException.new("One of the parameters are empty")
end
if vtag.timestamp.empty?
vtag.timestamp = Time.now.to_s("%Y-%m-%d:%H:%M:%S")
end
params = "/api/v1/addTag?key=#{vtag.key}&application=#{vtag.application}&subsystem=#{vtag.subsystem}&name=#{vtag.name}×tamp=#{vtag.timestamp}"
response = HTTP::Client.new("api.coralogix.com", tls: true).get(params)
puts response.body
puts response.status_code
end
This is the error running the compiled binary on ubuntu:
No address found for api.coralogix.com:443 over TCP (Socket::Error)
from usr/share/crystal/src/string.cr:4193:13 in 'socket'
from usr/share/crystal/src/http/client.cr:500:19 in 'exec_internal_single'
from usr/share/crystal/src/http/client.cr:486:16 in '???'
from usr/share/crystal/src/crystal/main.cr:0:3 in 'main'
from ???
from ???
from ???