-
Notifications
You must be signed in to change notification settings - Fork 80
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
🇨🇦 Use UNDICI fetch in Canada because of their badly configured servers #275
Conversation
4f0d772
to
57b2846
Compare
Thanks so much for this! Is |
It does not require any extra env variables! The one downside is I haven't had time to write the mocks for using |
666b98b
to
270bb3d
Compare
@@ -111,6 +113,40 @@ export class CanadianController extends SessionController<CanadianBlueLinkyConfi | |||
/* eslint-disable @typescript-eslint/no-explicit-any */ | |||
private async request(endpoint, body: any, headers: any = {}): Promise<any | null> { | |||
logger.debug(`[${endpoint}] ${JSON.stringify(headers)} ${JSON.stringify(body)}`); | |||
const [major,,] = process.versions.node.split('.').map(Number); | |||
if (major >= 21) { | |||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw we are setting NODE_TLS_REJECT_UNAUTHORIZED
to disable TLS validation, I thought we only need to override via SSL_OP_LEGACY_SERVER_CONNECT
?
Lets make this becomes 9.x version target and we update the https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines If you can do that we can shipit ❤️ ❤️ ❤️ |
Hmm, are you sure the engine should be set to Node > 21? It's using Happy to do it! Or I could rewrite the rest to use |
@djensenius you're right this should be good then and can stay 8.x. Merging 😅. |
@Hacksore, |
Published v8.3.1, give that a try. |
Hello @djensenius, I tried to use this new version but I got the following error: Client Error GotError [RequestError]: write EPROTO 405CCDDA01000000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
code: 'EPROTO', Just for giggles I changed my Country to Canada and I I get "car was not found" for obvious reasons. Was the change you made only applied to Canada? if so, do you think it can be applied to the United States? Environment: Kind regards, |
Yes, only Canada and only Node 21+. Which country are you? |
I am in the USA and to work around the problem I use node 16, but since it is not supported anymore by Homebridge and other programs. Is there something you can do to help us? |
@carlosgamezvillegas if you (or someone) wants to update the automated tests to mock I'm a little stretched thin for time and I'm a little unhappy about not having tests merged with this change for Canada. |
@djensenius, |
This pull request includes changes to enhance the codebase's compatibility with newer versions of Node.js, does some linting, and update dependencies. The most important change is an update to Canadian code to use the
fetch
function from theundici
library instead ofgot
for HTTP requests if the Node.js version is 21 or higher.This addresses #254