3
votes

I'm trying to create a new Azure Mobile Service, however when trying to call a Custom API it generates the following error in the logs of the service.

An error occurred creating push for user scripts: azure.notificationHubService could not be created. HubName: "servicenamehub" ConnectionString "Endpoint=sb://servicenamehub-ns.servicebus.windows.net/; SharedAccessKeyName=DefaultFullSharedAccessSignature; SharedAccessKey={accesskey};EntityPath=servicenamehub": Error from create-Error: Invalid connection string setting key "entitypath".

The error only seems to generate when making an API call, not when making a call on a table.

The MS_NotificationHubConnectionString is where this connection string is stored, however it was auto generated along with the service hub and isn't editable in the service configuration.

The EntityPath key doesn't appear in the MS_NotificationHubConnectionString of any of my older services. The Mobile Service has a JavaScript back end.

How do I prevent this error or remove the EntityPath key from the connection string?

1
Can you share the code from the custom API?Adrian Hall
Also, is this Azure Mobile Service or Azure Mobile Apps? (classic or new portal)?Adrian Hall
It happens when using the default code or custom code, on both GET and POST. It's Mobile Services in classic.DotEfekts

1 Answers

1
votes

Currently, here is a workaround: we login Kudu console site of the Mobile Service backend, modify MS_NotificationHubConnectionString in the script which will create notification hub service directly in source code.

  1. login in Kudu console site, whose url should be https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
  2. In the file system list in the page, enter to the path D:\home\site\wwwroot\node_modules\azure-mobile-services\runtime\push, edit the file pushadapter.js
  3. Add following code to the start of the function PushAdapter in this script around line 22:

    var string = options.MS_NotificationHubConnectionString; var index = string.indexOf('EntityPath'); options.MS_NotificationHubConnectionString = index>0?string.slice(0,string.indexOf('EntityPath')-1):string;

Any further concern, please feel free to let me know.