node.jsazuriteazure-tableclient

How to change option allowInsecureConnection Node.Js working with Azurite


I try to connect to a Table in Azurite from an azure function written in node.js

myTableClient = TableClient.fromConnectionString(process.env.STORAGE_CONNECTION_STRING,
"myTable" );   
entity = await myTableClient.getEntity("partitionkey", "rowkey");

I am getting

Cannot connect to http://127.0.0.1:10002/devstoreaccount1/myTable(PartitionKey='partitionkey',RowKey='rowkey') while allowInsecureConnection is false.

I understand there is a difference connecting to Azure and to Azurite (which is by default over Http but not Https) How can I change this setting allowInsecureConnection so the code can work with Azurite for testing purposes?

I see there is 3rd parameter in constrtuctor of the TableClient , called TableServiceClientOptions but I cannot see in documentation how it can be used to manipulate allowInsecureConnection setting for Azurite.


Solution

  • The decision was found and is fairly simple

    myTableClient = TableClient.fromConnectionString(process.env.STORAGE_CONNECTION_STRING, "myTable", { allowInsecureConnection: true } );