Aspnetcore: SignalR Message Pack Client Library not running in browser when using Angular Cli

Created on 23 Apr 2019  Â·  10Comments  Â·  Source: dotnet/aspnetcore

After importing MessagePackHubProtocol from @aspnet/signalr-protocol-msgpack inside of an Angular app using the Angular cli, the application will no longer run in the browser.

You will see the following exception in the console.

image

Steps to reproduce the behavior:

Clone and run the following app:
https://github.com/QuinntyneBrown/ng-signalr-protocol-msgpack-issue

or

  1. Create an angular app using the angular cli
  2. npm install @aspnet/signalr and @aspnet/signalr-protocol-msgpack
  3. In the app component, import HubConnectionBuilder from @aspnet/signalr
  4. In the app component, import MessagePackHubProtocolfrom @aspnet/signalr-protocol-msgpack
  5. In the app component, add a method called ngOnInit
  6. Inside the ngOnInit method, add the following code

    var connection = new HubConnectionBuilder()
    .withUrl("")
    .withHubProtocol(new MessagePackHubProtocol())
    .build();

  7. run the app with the console open, and you should see the error. The UI will be blank.

Expected behavior

You should see the standard angular cli default page.

5.0-candidate affected-few area-signalr bug severity-minor

All 10 comments

I created the following duplicate issue with angular-cli.

https://github.com/angular/angular-cli/issues/14253

I was asked to look at the following comment. https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814

Take a look at https://github.com/aspnet/SignalR/issues/2736#issuecomment-411144971 for a workaround.

triage we can investigate using a newer Buffer package that doesn't rely on global being defined.

Angular broke this intentionally.
https://github.com/angular/angular-cli/issues/9827#issuecomment-386154063

On Wed, 24 Apr 2019, 16:36 BrennanConroy, notifications@github.com wrote:

Take a look at aspnet/SignalR#2736 (comment)
https://github.com/aspnet/SignalR/issues/2736#issuecomment-411144971
for a workaround.

@triage we can investigate using a newer Buffer package that doesn't
rely on global being defined.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/AspNetCore/issues/9687#issuecomment-486294144,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADKSKTFHCMCSIF46BZ2FAU3PSB46JANCNFSM4HH4KWKQ
.

Same error here!!!

We'll look and see if there's a good option here. We might end up dropping polyfills for some of these altogether so that each environment can bring an appropriate polyfill.

We aren't going to be able to get to this in 3.0. Moving to the backlog.

So... You're gonna release a version that is not working with Angular?

Is the linked workaround insufficient for you? If so we can bump the priority of this.

Sorry, @anurse I didn't see that workaround!

The workaround worked for me after I added the package "buffer" to package.json.
Edit: Gotta be something better than doing all this to make MessagePack work lol

Was this page helpful?
0 / 5 - 0 ratings