Page MenuHomePhabricator

Homepage new Impact module: SyntaxError: Unexpected token
Closed, ResolvedPublic2 Estimated Story PointsPRODUCTION ERROR

Description

Error
message
"message": "SyntaxError: Unexpected token '<', \"<!doctype \"... is not valid JSON"
trace
"level": "ERROR",
   "url": "https://en.wikipedia.org/wiki/Special:Homepage?title=Special:Homepage&source=specialconfirmemail&namespace=-1",
  
"stack_trace": "at GrowthTasksApi.handleError  https://en.wikipedia.org/w/load.php?lang=en&modules=ext.growthExperiments.DataStore&skin=vector-2022&version=1e1z8:25:852\nat mightThrow  https://en.wikipedia.org/w/load.php?lang=en&modules=%40wikimedia%2Fcodex%2Cjquery%2Coojs-ui-core%2Cvue%7Cext.growthExperiments.Homepage.NewImpact%2CSuggestedEdits&skin=vector-2022&version=1p84k:163:648\nat process  https://en.wikipedia.org/w/load.php?lang=en&modules=%40wikimedia%2Fcodex%2Cjquery%2Coojs-ui-core%2Cvue%7Cext.growthExperiments.Homepage.NewImpact%2CSuggestedEdits&skin=vector-2022&version=1p84k:164:309",
Impact
  • 2 errors in 24 hours
  • I was not able to trigger the error in the Console

Event Timeline

Etonkovidova renamed this task from SyntaxError: Unexpected token - Homepage new Impact module to Homepage new Impact module: SyntaxError: Unexpected token .Jan 26 2024, 1:02 AM
Urbanecm_WMF moved this task from Inbox to Triaged on the Growth-Team board.

I think this happened because the API was not working properly for a short while, and someone used Special:Homepage over that period of time. I can't find in the logs which API endpoint exactly triggered this though. If it doesn't keep reoccuring, I think it's a nice-to-fix error scenario. CC @Sgs in case I'm missing something.

Yes it would be nice to handle this error, maybe from composables/useMWRestApi.js since it's coming from NewImpact.

KStoller-WMF set the point value for this task to 2.Feb 20 2024, 4:07 PM
KStoller-WMF raised the priority of this task from Low to Medium.
KStoller-WMF moved this task from Up Next to Sprint 8 (Growth Team) on the Growth-Team board.

Change 1006174 had a related patch set uploaded (by Cyndywikime; author: Cyndywikime):

[mediawiki/extensions/GrowthExperiments@master] Handle invalid JSON response and log errors

https://gerrit.wikimedia.org/r/1006174

Yes it would be nice to handle this error, maybe from composables/useMWRestApi.js since it's coming from NewImpact.

I missed the obvious at GrowthTasksApi.handleError which is the error handler for GrowthTasksApi requests, only used in GrowthTasksApi.fetchTasks. It seems unrelated to NewImpact, the module is pulled in since it's a homepage request. cc @Cyndymediawiksim

I think this happened because the API was not working properly for a short while, and someone used Special:Homepage over that period of time. I can't find in the logs which API endpoint exactly triggered this though. If it doesn't keep reoccuring, I think it's a nice-to-fix error scenario. CC @Sgs in case I'm missing something.

Just to be clear, we would want to still log the error but have a more meaningful message that we can easily discard while doing team chores. Or on the opposite, are you suggesting that we just catch the error and not produce any logs?

I think this happened because the API was not working properly for a short while, and someone used Special:Homepage over that period of time. I can't find in the logs which API endpoint exactly triggered this though. If it doesn't keep reoccuring, I think it's a nice-to-fix error scenario. CC @Sgs in case I'm missing something.

Just to be clear, we would want to still log the error but have a more meaningful message that we can easily discard while doing team chores. Or on the opposite, are you suggesting that we just catch the error and not produce any logs?

The 5xx error message should be logged either way, so it is technically redundant. If we log this explicitly, it might be easier to catch if it is happening too frequently for just our API (if it is happening for all APIs, it'll be noticed by SRE-managed alarms). TLDR: No strong opinion either way, both would be reasonable IMO.

Change 1006174 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Handle invalid JSON response and log errors

https://gerrit.wikimedia.org/r/1006174