-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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 | Electron | CookieJar is creating issue with Electron .Net App + Angular 14 #52656
Comments
i ran into a similar issue with an electron app when upgrading from signalr 6 to 8. after adding
to my package.json it appears to be working again! During debugging this I noticed that the call to CookieJar.getCookieString(...) had the callback and the url in a different order, than the code seemed to expect it. It appears that somehow the wrong (old) version gets required... Output with the resolution restrictionyarn why tough-cookie
yarn why v1.22.19
[1/4] Why do we have the module "tough-cookie"...?
[2/4] Initialising dependency graph...
warning Resolution field "tough-cookie@4.1.3" is incompatible with requested version "tough-cookie@^3.0.1"
warning Resolution field "tough-cookie@4.1.3" is incompatible with requested version "tough-cookie@~2.5.0"
warning Resolution field "tough-cookie@4.1.3" is incompatible with requested version "tough-cookie@^2.3.3"
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "tough-cookie@4.1.3"
info Reasons this module exists
- "_project_#jest-environment-jsdom#jsdom" depends on it
- Hoisted from "_project_#jest-environment-jsdom#jsdom#tough-cookie"
- Hoisted from "_project_#@app#infrastructure#@microsoft#signalr#fetch-cookie#tough-cookie"
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#tough-cookie"
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#request-promise-native#tough-cookie"
- Hoisted from "_project_#@app#infrastructure#@jest-runner#electron#jest-runner#jest-config#jest-environment-jsdom#jsdom#tough-cookie"
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#request#tough-cookie"
info Disk size without dependencies: "160KB"
info Disk size with unique dependencies: "784KB"
info Disk size with transitive dependencies: "828KB"
info Number of shared dependencies: 5
Done in 0.62s. Output without the additional resolution restriction:yarn why tough-cookie
yarn why v1.22.19
[1/4] Why do we have the module "tough-cookie"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "tough-cookie@2.5.0"
info Has been hoisted to "tough-cookie"
info Reasons this module exists
- "workspace-aggregator-0efcd8c3-fafa-44cd-9736-47bb72ea7074" depends on it
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#request-promise-native#tough-cookie"
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#request#tough-cookie"
info Disk size without dependencies: "108KB"
info Disk size with unique dependencies: "632KB"
info Disk size with transitive dependencies: "632KB"
info Number of shared dependencies: 2
=> Found "jsdom#tough-cookie@4.1.3"
info This module exists because "_project_#jest-environment-jsdom#jsdom" depends on it.
info Disk size without dependencies: "136KB"
info Disk size with unique dependencies: "760KB"
info Disk size with transitive dependencies: "804KB"
info Number of shared dependencies: 5
=> Found "fetch-cookie#tough-cookie@4.1.3"
info This module exists because "_project_#@app#infrastructure#@microsoft#signalr#fetch-cookie" depends on it.
info Disk size without dependencies: "136KB"
info Disk size with unique dependencies: "760KB"
info Disk size with transitive dependencies: "804KB"
info Number of shared dependencies: 5
=> Found "jest-jasmine2#tough-cookie@3.0.1"
info Reasons this module exists
- "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom" depends on it
- Hoisted from "_project_#jest-jasmine2#jest-runtime#jest-config#jest-environment-jsdom#jsdom#tough-cookie"
info Disk size without dependencies: "112KB"
info Disk size with unique dependencies: "652KB"
info Disk size with transitive dependencies: "652KB"
info Number of shared dependencies: 3
=> Found "@jest-runner/electron#tough-cookie@3.0.1"
info Reasons this module exists
- "_project_#@app#infrastructure#@jest-runner#electron#jest-runner#jest-config#jest-environment-jsdom#jsdom" depends on it
- Hoisted from "_project_#@app#infrastructure#@jest-runner#electron#jest-runner#jest-config#jest-environment-jsdom#jsdom#tough-cookie"
info Disk size without dependencies: "112KB"
info Disk size with unique dependencies: "652KB"
info Disk size with transitive dependencies: "652KB"
info Number of shared dependencies: 3
Done in 0.58s. |
adding an explicit dependency to adding trace log if someone ends up googling for this error... @app/infrastructure: [2024-02-21T16:43:22.245Z] Debug: Starting HubConnection.
@app/infrastructure: [2024-02-21T16:43:22.245Z] Debug: Starting connection with transfer format 'Text'.
@app/infrastructure: [2024-02-21T16:43:22.245Z] Debug: Sending negotiation request: https://some-domain.non-existent/somehub/negotiate?negotiateVersion=1.
@app/infrastructure: [2024-02-21T16:43:22.246Z] Debug: HubConnection failed to start successfully because of error 'Error: Failed to complete negotiation with the server: TypeError: Cannot read properties of undefined (reading 'secure')'.
@app/infrastructure: [2024-02-21T16:43:22.246Z] Warning: Error from HTTP request. TypeError: Cannot read properties of undefined (reading 'secure').
@app/infrastructure: [2024-02-21T16:43:22.246Z] Error: Failed to complete negotiation with the server: TypeError: Cannot read properties of undefined (reading 'secure')
@app/infrastructure: [2024-02-21T16:43:22.246Z] Error: Failed to start the connection: Error: Failed to complete negotiation with the server: TypeError: Cannot read properties of undefined (reading 'secure') |
where did you put this? |
the log level can be set in the connection constructor like this:
and tough-cookie dependency is added to the package.json, for me in
|
does not work, |
I downgraded @microsoft/signalr 8 to 6.0.1 and it worked |
I have a similar issue after upgrading to version 8.0.0 (Angular v17 with ASP.NET mono repo) (cf. https://github.com/visualengineers/reflex) |
Is there an existing issue for this?
Describe the bug
I am using Electron.Net as backend and Angular as frontend to initiate System App. When I am trying to setup connection with HubConnectionBuilder, I am getting issue:
CookieJar is not a constructor
For Further research, I got to realize that this issue arises due to its requirement of fetch-cookie in DefaultHttpClient.ts file in @microsoft/signalR package. For now, I have used downgraded version of it, but will be looking for solution with latest version 8.0.0.
My frontend code is like below:
this.hubConnectionBuilder = new HubConnectionBuilder()
.configureLogging(LogLevel.Information)
.withUrl("http://localhost:4200/ABCD")
.build()
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.414
Anything else?
No response
The text was updated successfully, but these errors were encountered: