pentacent / keila

Open Source Newsletter Tool.

Home Page:https://keila.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

500 server error on Campaign send via API

dompie opened this issue · comments

Hello, I have a campaign with the following fields:

{
  "data": {
    "data": null,
    "id": "nmc_j7r4Bqg5",
    "inserted_at": "2024-03-19T10:40:51Z",
    "updated_at": "2024-03-19T10:41:35Z",
    "settings": {
      "type": "text"
    },
    "subject": "Send campaign test 19032024-104051",
    "text_body": null,
    "sender_id": "nms_weLJnLY5",
    "template_id": null,
    "sent_at": null,
    "scheduled_for": null,
    "segment_id": null
  }
}

When I send the campaign using the API, I get an "Internal server error" and the logs show the following:

10:41:35.405 request_id=F74kXjBoi_NgSnAAAIKi [info] POST /api/v1/campaigns/nmc_j7r4Bqg5/actions/send
10:41:35.410 [error] #PID<0.22114.0> running KeilaWeb.Endpoint (connection #PID<0.22109.0>, stream id 2) terminated
Server: keila.local:4000 (http)
Request: POST /api/v1/campaigns/nmc_j7r4Bqg5/actions/send
** (exit) an exception was raised:
    ** (Plug.Conn.NotSentError) a response was neither set nor sent from the connection
        (phoenix 1.6.11) lib/phoenix/endpoint/cowboy2_handler.ex:80: Phoenix.Endpoint.Cowboy2Handler.maybe_send/2
        (phoenix 1.6.11) lib/phoenix/endpoint/cowboy2_handler.ex:55: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.10.0) /deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.10.0) /deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.10.0) /deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

But the E-Mails to contacts will be sent anyway.

I would strongly expect to have no e-mail sending at all, when the campaign sending API endpoint shows internal server error.

Edit: Scheduling this campaign works as expected.