You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the following code with the correct endpoint, project, and API key.
constsdk=require('node-appwrite');letclient=newsdk.Client();client.setEndpoint('https://[HOSTNAME_OR_IP]/v1')// Your API Endpoint.setProject('5df5acd0d48c2')// Your project ID.setKey('919c2d18fb5d4...a2ae413da83346ad2')// Your secret API key.setSelfSigned()// Use only on dev mode with a self-signed SSL cert;letusers=newsdk.Users(client);letpromise=users.list();promise.then(function(response){console.log(response);},function(error){console.log(error);});
馃憤 Expected behavior
Assuming your Appwrite instance has a self signed certificate, the API call should work.
Furthermore, we shouldn't be using this NODE_TLS_REJECT_UNAUTHORIZED environment variable because it disables TLS for all network requests, but we should only allow self-signed certificates for the Appwrite API calls. Instead of setting NODE_TLS_REJECT_UNAUTHORIZED, we should be passing an option to axios like we do in the CLI:
options.httpsAgent = new https.Agent({ rejectUnauthorized: false });
馃幉 Appwrite version
Appwrite Cloud
馃捇 Operating system
Linux
馃П Your Environment
This was seen in node-appwrite version 11.0.0
馃憖 Have you spent some time to check if this issue has been raised before?
馃憻 Reproduction steps
Run the following code with the correct endpoint, project, and API key.
馃憤 Expected behavior
Assuming your Appwrite instance has a self signed certificate, the API call should work.
馃憥 Actual Behavior
The API call will fail with an error like:
The way we're handing self-signed certificates is:
However, Node does a strict check:
As such, the check fails.
Furthermore, we shouldn't be using this
NODE_TLS_REJECT_UNAUTHORIZED
environment variable because it disables TLS for all network requests, but we should only allow self-signed certificates for the Appwrite API calls. Instead of settingNODE_TLS_REJECT_UNAUTHORIZED
, we should be passing an option to axios like we do in the CLI:馃幉 Appwrite version
Appwrite Cloud
馃捇 Operating system
Linux
馃П Your Environment
This was seen in node-appwrite version 11.0.0
馃憖 Have you spent some time to check if this issue has been raised before?
馃彚 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: