fix(email-connectors): return profile-import error early in KlaviyoAdapter.upsertSubscriber

オープン 初心者向け
#64 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
api, backend

調査の方向性

packages/email-connectors/src/adapters/klaviyo.adapter.ts、特に107〜136行付近のKlaviyoAdapter.upsertSubscriberを読んでください。任意のリスト関連付けリクエストの前に、/profile-import/のレスポンスがどのように処理されるかを追ってください。完了条件は、プロフィールのインポートに失敗した場合、リストリクエストを行わずにエラーを直ちに返し、成功した場合は既存の動作を維持することです。

索引モデルが issue の本文から書いたものです。

説明

backend good first issue
Problem Description

In packages/email-connectors/src/adapters/klaviyo.adapter.ts (upsertSubscriber, lines 86-136), when POST /profile-import/ fails (!profileRes.ok), profileId remains undefined. When listId is provided, the method still proceeds to call POST /lists/${listId}/relationships/profiles/ with id: undefined, which fails and masks the original /profile-import/ error behind "Failed to add to Klaviyo list: ...".


Expected Behavior
  • If POST /profile-import/ returns a non-OK response (!profileRes.ok), upsertSubscriber should immediately return { success: false, error: 'Failed to create Klaviyo profile: ...' } without making a wasted second request.
  • When POST /profile-import/ succeeds (profileRes.ok), behavior remains unchanged.

Where to Look
  • packages/email-connectors/src/adapters/klaviyo.adapter.ts (upsertSubscriber, lines 107-136)

Solution / Implementation Guide
  1. Right after const profileRes = await fetch(...), check if (!profileRes.ok) first:
    if (!profileRes.ok) {
      const errText = await profileRes.text();
      return { success: false, error: `Failed to create Klaviyo profile: ${errText}` };
    }
    
  2. Parse profileId = profileJson?.data?.id, and only proceed to POST /lists/${listId}/relationships/profiles/ when listId is provided and profileRes.ok succeeded.
主要言語
TypeScript
スター
2
フォーク
1
平均マージ
6分
マージ済み PR(30日)
27

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sumamakhan761/tryinstance のほかの issue

sumamakhan761/tryinstance の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。