mozmeao / basket

Mozilla's email newsletter subscription management API service
https://basket.mozilla.org
Mozilla Public License 2.0
16 stars 17 forks source link

The "Remove me from all the subscriptions on this page:" option does not work #953

Open mariaberlinger opened 1 year ago

mariaberlinger commented 1 year ago

FxA version:

Prerequisites:

Steps to reproduce:

  1. Navigate to https://accounts.stage.mozaws.net/ and login using an existing account;
  2. Click on the "Email communications" option displayed in the navigation menu;
  3. Click on "Sign in" button;
  4. Check the "Remove me from all the subscriptions on this page:" checkbox displayed at the bottom of the page and click the Save Preferences button;

Expected result:

Actual result:

Notes:

pmac commented 1 year ago

I can't reproduce this. It's possible for there to be a delay between submitting the form and the data being recorded in our system. Can you try again with the same user and see if perhaps it has worked in the interim? Though I did just test it and I saw results immediately.

mariaberlinger commented 1 year ago

Hello @pmac I am still able to reproduce this issue in Train 1.249.3 stage. Attaching screen record. screenrecord email preferences

pmac commented 1 year ago

I still can't reproduce. Thanks for the screen grab. @alexgibson can you try to reproduce?

alexgibson commented 1 year ago

I tried this using the STR above and was also unable to reproduce. After creating a new account, and then checking unsubscribe all, my basket user data no longer contains any newsletters, and also records my unsubscribe reason:

{
  "amo_display_name": null,
  "amo_last_login": null,
  "amo_location": null,
  "amo_homepage": null,
  "amo_user": false,
  "amo_id": null,
  "email": "********@mozmail.com",
  "token": "*********",
  "optin": true,
  "id": null,
  "first_name": null,
  "last_name": null,
  "country": null,
  "format": "H",
  "lang": "en",
  "optout": true,
  "reason": "You send too many emails.\n\nOther…\n\ntest",
  "email_id": "*********************************",
  "created_date": "2023-01-11T09:45:08.746478+00:00",
  "last_modified_date": "2023-01-11T09:46:17.967964+00:00",
  "fxa_id": null,
  "fxa_primary_email": null,
  "fxa_create_date": null,
  "fxa_lang": "en-US,en;q=0.5",
  "fxa_service": null,
  "fxa_deleted": false,
  "mofo_relevant": false,
  "newsletters": [],
  "fpn_country": null,
  "fpn_platform": null,
  "relay_country": null,
  "status": "ok"
}

If I close the tab, switch back to accounts.stage.mozaws.net/settings, and click "Email communications" again, then the management page correctly confirms my change:

management-1

I'll continue to look into this and try to figure out any possible additional things we can look for.

alexgibson commented 1 year ago

When I look up @mariaberlinger's basket user data, I can confirm they are still opted in to the newsletters, despite the unsubscribe reason also being recorded. The optout field is also false.

{
  "amo_display_name": null,
  "amo_last_login": null,
  "amo_location": null,
  "amo_homepage": null,
  "amo_user": false,
  "amo_id": null,
  "email": "**********@mozilla.com",
  "token": "***************",
  "optin": true,
  "id": null,
  "first_name": null,
  "last_name": null,
  "country": "us",
  "format": "H",
  "lang": "en",
  "optout": false,
  "reason": "Other…\n\nvdf",
  "email_id": "****************************",
  "created_date": "2023-01-10T09:37:35.775550+00:00",
  "last_modified_date": "2023-01-10T09:39:19.205241+00:00",
  "fxa_id": null,
  "fxa_primary_email": null,
  "fxa_create_date": null,
  "fxa_lang": "en-US,en;q=0.5",
  "fxa_service": null,
  "fxa_deleted": false,
  "mofo_relevant": true,
  "newsletters": [
    "common-voice",
    "firefox-accounts-journey",
    "internet-health-report",
    "knowledge-is-power",
    "mozilla-and-you",
    "mozilla-foundation",
    "take-action-for-the-internet",
    "test-pilot"
  ],
  "fpn_country": null,
  "fpn_platform": null,
  "relay_country": null,
  "status": "ok"
}
alexgibson commented 1 year ago

@pmac I found this error in Sentry, which corresponds to @mariaberlinger's email_id and also appears to have occurred during an unsubscribe task:

https://sentry.io/organizations/mozilla/issues/3857830225/?project=6260602

pmac commented 1 year ago

Good find! I see Unique ID conflict: 'Contact with primary_email, basket_token, mofo_email_id, or fxa_id already exists' was returned from CTMS. Strange. Maybe @grahamalama can shed some light on what that means exactly. Maybe basket is failing to look up the record somehow but it does exist so trying to create a new record and failing because it does exist. Not sure yet.

grahamalama commented 1 year ago

@pmac, found that error in this function and its complementary test. Definitely worth investigating. I only see it there in that PATCH method, so it seems like Basket is doing the right thing?

LuminitaB commented 1 year ago

Hello team, While running the smoke tests in Production, on Train 1.253.3, we noticed that this issue seems to be fixed. (see the below screenshot). image Has anything been done to address it and it should be closed? Thank you. CC: @mariaberlinger

mariaberlinger commented 1 year ago

Hello, This is still reproducible on Train 1.269.1 stage. The newsletter options are not cleared and sometimes choosing new ones doesn't work.

alexgibson commented 1 year ago

@mariaberlinger I'm curious if your email address is still encountering the same error we saw above. Could you perhaps ping me on Slack and share your address? That way we can take a look. Thanks

alexgibson commented 1 year ago

I've tried replicating the issue using @mariaberlinger's email, but so far I'm not able to reproduce. I've checked their basket data after each form submission, and things look ok?

All I can think so far is that sometimes there could be a delay when unsubscribing as tasks are queued up.