Skip to content
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

allowSelfSigned not working for requestThingDescription #1268

Closed
danielpeintner opened this issue Apr 22, 2024 · 4 comments · Fixed by #1269
Closed

allowSelfSigned not working for requestThingDescription #1268

danielpeintner opened this issue Apr 22, 2024 · 4 comments · Fixed by #1269

Comments

@danielpeintner
Copy link
Member

danielpeintner commented Apr 22, 2024

Not sure where to inquire for this:

HttpConfig for https client seems to ignore allowSelfSigned:

const { HttpsClientFactory } = require("@node-wot/binding-http");


const servient = new Servient();
servient.addClientFactory(new HttpsClientFactory({ 
        allowSelfSigned : true,
    }));

servient.start().then(async (WoT) => {
    const td = await WoT.requestThingDescription("https://localhost:8083/spectrometer/ocean-optics/USB2000-plus/resources/wot");

I get error:

FetchError: request to https://localhost:8083/spectrometer/ocean-optics/USB2000-plus/resources/wot failed, reason: self-signed certificate
at ClientRequest. (H:\New Work\node-clients\serial-utility\node_modules\node-fetch\lib\index.js:1501:11)
at ClientRequest.emit (node:events:514:28)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'DEPTH_ZERO_SELF_SIGNED_CERT',
code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}

Originally posted by @VigneshVSV in #177 (comment)

@danielpeintner
Copy link
Member Author

I looked into your problem and noticed that allowSelfSigned is not taken into account for WoT.requestThingDescription(...). Instead it kicks in for interaction methods like thing.readProperty(...) only

@VigneshVSV
Copy link

That would easily explain why!

@danielpeintner
Copy link
Member Author

I created #1269 which should fix the issue... I tested locally. if you can test/check also that would be great. Thanks!

@VigneshVSV
Copy link

Thanks, I built the browser bundle and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants