curl / curl-container

curl images
MIT License
61 stars 12 forks source link

Unable to curl Google Chat webhook for docker image version 8.4.0 #42

Closed khtee closed 11 months ago

khtee commented 11 months ago

Received error when curl to chat.googleapis.com. It works for docker image version 8.3.0

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to chat.googleapis.com port 443 after 26 ms: Couldn't connect to server
time="2023-10-13T01:04:23.000Z" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 7
dfandrich commented 11 months ago

This is more likely a problem in the environment than in curl. What command are you running to get that? This connects fine for me in both versions:

$ docker run --rm curlimages/curl:8.4.0 curl https://chat.googleapis.com % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 38 0 38 0 0 231 0 --:--:-- --:--:-- --:--:-- 233

Not Found

Error 404

$ docker run --rm curlimages/curl:8.3.0 curl https://chat.googleapis.com % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 38 0 38 0 0 276 0 --:--:-- --:--:-- --:--:-- 279

Not Found

Error 404

khtee commented 11 months ago

I'm running as a container in k8s pod. This is the hash for the image it pulls with latest tag

container:
  image: curlimages/curl:latest
  imageID: >-
    docker-pullable://curlimages/curl@sha256:4a3396ae573c44932d06ba33f8696db4429c419da87cbdc82965ee96a37dd0af
  command:
    - sh
    - '-c'
  args:
    - >-
      curl -H 'Content-Type: application/json' -X POST
      '{{inputs.parameters.webhook}}' -d '{"text":
      "{{inputs.parameters.message}}"}'
dfandrich commented 11 months ago

And does that exact same configuration fail if "latest" is replaced with "8.3.0"? That sounds very strange, since the error message points to a network issue, not an application issue.

khtee commented 11 months ago

no, the same configuration can work when I specify image tag 8.3.0.

dfandrich commented 11 months ago

I'm struggling to think of a reason 8.4.0 isn't working in that case when no-one else has reported a problem with the Docker image. Are the two versions using the same IP addresses? Try using the -v option to log the IP address and compare them. There were some Happy Eyeballs changes in this version, so maybe it's using IPv6 now and failing or something.

xquery commented 11 months ago

it would be useful if we can confirm this is a problem with curl rather then something specific to the curl container itself.

khtee commented 11 months ago

Perhaps this issue is coming from my environment setup. I can't reproduce this issue when running in a fresh environment. Thanks for helping.