Page MenuHomePhabricator

Echo notifications does not load (Foreign APIs must have a valid url)
Open, Needs TriagePublic


I got a cross-notification from enwp, I pressed it, got to my edit that was reverted and pressed the talk-page link for the user that reverted me. I got to and then I pressed the red echo-icon (most likely for the same notifiction thta I got cross-wiki while on Commons). But when I pressed the icon it just loaded and wouldn't "load". In console it said:

Uncaught Error: Foreign APIs must have a valid url.

and when I tried again, it took me to the following CallStack source:

api.NetworkHandler);mw.echo.api.NetworkHandler.static.waitForAllPromises=function(promiseArray){var i,promises=promiseArray.slice(0),counter=0,deferred=$.Deferred(),countPromises=function(){counter++;if(counter===promises.length){deferred.resolve(promises);}};if(!promiseArray.length){deferred.resolve();}for(i=0;i<promises.length;i++){promises[i].always(countPromises);}return deferred.promise();};mw.echo.api.NetworkHandler.prototype.getApiHandler=function(name){return this.handlers[name];};mw.echo.api.NetworkHandler.prototype.addApiHandler=function(name,config,isForeign){if(this.handlers[name]){return;}if(isForeign){if(!config.url){throw new Error('Foreign APIs must have a valid url.');}this.addCustomApiHandler(name,new mw.echo.api.ForeignAPIHandler(config.url,config));}else{this.addCustomApiHandler(name,new mw.echo.api.LocalAPIHandler(config));}};mw.echo.api.NetworkHandler.prototype.addCustomApiHandler=function(name,handler){if(!this.handlers[name]){this.handlers[name]=handler;}};})(

Related Objects

Event Timeline

Josve05a created this task.Mar 13 2016, 3:29 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptMar 13 2016, 3:29 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Happens all the time now on enwp. I can't get the notification-tab to load. I must go to

Josve05a updated the task description. (Show Details)Mar 13 2016, 3:34 PM
Josve05a renamed this task from Echo notifications does not load to Echo notifications does not load (Foreign APIs must have a valid url).Mar 13 2016, 3:38 PM

Hmm, @MZMcBride had the same thing happen to him and I believe he tracked it down to a user script?

(I don't think this is related to the MW API though).

Hmm, @MZMcBride had the same thing happen to him and I believe he tracked it down to a user script?

Do you know which userscript? I haven't changed my userscripts in weeks, either they have changed them, or MediaWiki changed.

I had an old version of morebits.js, I think.

matmarex added a subscriber: matmarex.EditedMar 21 2016, 2:18 PM

Looking at Echo code:

				for ( source in sourceDefinitions ) { source, sourceDefinitions[ source ], true );
	mw.echo.api.NetworkHandler.prototype.addApiHandler = function ( name, config, isForeign ) {
		// ...
		if ( isForeign ) {
			if ( !config.url ) {
				throw new Error( 'Foreign APIs must have a valid url.' );
			this.addCustomApiHandler( name, new mw.echo.api.ForeignAPIHandler( config.url, config ) );
		} else {
			this.addCustomApiHandler( name, new mw.echo.api.LocalAPIHandler( config ) );

This error will be thrown if any user script modifies Object.prototype, causing additional properties to appear in the for ... in loop. Doing this in scripts is not supported (precisely because it causes this kind of hard-to-debug errors, see, but Echo could work around this by adding a hasOwnProperty check in that loop if the team wants to.

I haven't checked what this script do, nor have I removed it yet (on mobile right now). But will see if that fixes it. But my guess is that more users has scripts like that, and if Echo could make a workaround, that would be great!

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptOct 12 2019, 4:08 AM