From 59bf3609371da86a0aec20dec6a80fc2db2743cb Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 16 Apr 2026 21:00:24 +0000 Subject: [PATCH] Try to get more debug info on lob 420 error --- platform/mailer/mailer.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/mailer/mailer.go b/platform/mailer/mailer.go index 7457cc0d..4c6b2f0b 100644 --- a/platform/mailer/mailer.go +++ b/platform/mailer/mailer.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "io" "time" "github.com/Gleipnir-Technology/bob" @@ -55,7 +56,8 @@ func ComplianceSend(ctx context.Context, txn bob.Executor, row_id int32) error { return fmt.Errorf("organization %d has no Lob Address ID", organization.ID) } - content, err := pdf.GeneratePDF(ctx, compliance_req.PublicID) + path := fmt.Sprintf("/mailer/mode-3/%s", compliance_req.PublicID) + content, err := pdf.GeneratePDF(ctx, path) if err != nil { return fmt.Errorf("generate pdf: %w", err) } @@ -130,8 +132,13 @@ func sendMail(ctx context.Context, org_address_id string, public_id string, site var ltr = lob.NewLetterEditable(true, to_addr, from_addr, content_path, *lob.NewNullableLtrUseType(&use_type)) desc := fmt.Sprintf("Compliance request %s", public_id) ltr.SetDescription(desc) - result, _, err := client.LettersApi.Create(ctx_lob).LetterEditable(*ltr).Execute() + result, resp, err := client.LettersApi.Create(ctx_lob).LetterEditable(*ltr).Execute() + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("read lob response") + } + log.Debug().Str("status", resp.Status).Bytes("body", body).Msg("response from lob") if err != nil { return nil, fmt.Errorf("create letter: %w", err) }