-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SignalR Message Pack Client Library not running in browser when using Angular Cli #9687
Comments
I created the following duplicate issue with angular-cli. I was asked to look at the following comment. angular/angular-cli#9827 (comment) |
Take a look at aspnet/SignalR#2736 (comment) for a workaround. triage we can investigate using a newer |
Angular broke this intentionally.
angular/angular-cli#9827 (comment)
…On Wed, 24 Apr 2019, 16:36 BrennanConroy, ***@***.***> wrote:
Take a look at aspnet/SignalR#2736 (comment)
<aspnet/SignalR#2736 (comment)>
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
<#9687 (comment)>,
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. |
Does this repro with the latest changes? @BrennanConroy We changed the msg pack library so I wonder if the same issue exists. |
Thanks for contacting us. |
This might be fixed, I'll try it out and see if the issue is gone. |
Doesn't look like the issue repros with the new messagepack library. |
@BrennanConroy I stlill got errors when using @microsoft/signalr-protocol-msgpack with angular 11. I had to install the buffer package and add this to polyfill.js (from https://stackoverflow.com/a/64042896) import * as Buffer from '../node_modules/buffer/index';
// Fix Uncaught ReferenceError: global is not defined
(window as any).global = window;
// Fix Uncaught ReferenceError: Buffer is not defined
(window as any).process = {};
(window as any).process = window;
(window as any).process.browser = true;
(window as any).process.version = '';
(window as any).process.versions = { node: false };
(window as any).global.Buffer = Buffer.Buffer; |
Are you using the 6.0 preview version of the package? |
5.0.9 |
The 6.0+ version of the library doesn't have this issue. 5.0 and below will need to apply a workaround such as aspnet/SignalR#2736 (comment) or the one you listed. |
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.
Steps to reproduce the behavior:
Clone and run the following app:
https://github.com/QuinntyneBrown/ng-signalr-protocol-msgpack-issue
or
Create an angular app using the angular cli
npm install @aspnet/signalr and @aspnet/signalr-protocol-msgpack
In the app component, import HubConnectionBuilder from @aspnet/signalr
In the app component, import MessagePackHubProtocolfrom @aspnet/signalr-protocol-msgpack
In the app component, add a method called ngOnInit
Inside the ngOnInit method, add the following code
var connection = new HubConnectionBuilder()
.withUrl("")
.withHubProtocol(new MessagePackHubProtocol())
.build();
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.
The text was updated successfully, but these errors were encountered: