So I’ve setup a Go website which creates a PDF using Gotenberg (separate machines within the “personal” organization). For Gotenberg, I’ve created a flycast, so that it cannot be accessed by the public.
The issue is, I can send a CURL request to Gotenberg to test that it is working and it seems to be fine, but when my Go website sends a request (using gotenberg package - github.com/runatal/gotenberg-go-client/v8 - Go Packages) I get the error “request sending failed”. This is all that the logs show.
The Go website works on localhost and Gotenberg has been setup with the defaults (address 0.0.0.0 and port 3000 per Configuration | Gotenberg). So where did I go wrong?
Go website
package main
import (
"context"
"net/http"
"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
)
func main() {
client, err := gotenberg.NewClient("gotenbergtest.flycast:3000", http.DefaultClient)
// Creates the Gotenberg documents from a files paths.
index, err := document.FromPath("index.html", "/path/to/file")
// Create the HTML request.
req := gotenberg.NewHTMLRequest(index)
// If you wish to redirect the response directly to the browser, you may also use:
resp, err := client.Send(context.Background(), req)
}
CURL test
fly ssh console
curl \
--request POST gotenbergtest.flycast/forms/chromium/convert/url \
--form url=https://sparksuite.github.io/simple-html-invoice-template/ \
-o my.pdf
fly.toml
app = 'gotenbergtest'
primary_region = 'atl'
[build]
image = 'gotenberg/gotenberg:8'
[http_service]
internal_port = 3000
force_https = false # Flycast is http only, so force_https must be false.
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1