microsoft / DurableFunctionsMonitor

A monitoring/debugging UI tool for Azure Durable Functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't connect to local MSSQL DB: The certificate chain was issued by an authority that is not trusted

cgillum opened this issue · comments

This is happening when I try to run from the VS Code extension (installed today). Here's the full error message:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.

Here is my connection string:

Server=localhost;Database=DurableDB-v1.0.0;Trusted_Connection=True;

It works fine from my local function app, so I'm not sure what's going on. I tried doing things like setting Encrypt=False, Trusted_Connection=False, etc. but kept getting the same error every time.

Does the Durable Functions monitor make changes to the connection string? I'm not sure why this works from a local Durable Functions project but not from a local Durable Functions Monitor VS Code extension.

Hi @cgillum , the first thing to try is to hit the 'Refresh' button:

image

Then try to detach/reattach the backend:

image

Then finally try restarting VsCode.

DfMon might cache the connection string from your local.settins.json (which might originally not have all those extra flags needed), so the above steps are to flush that cache.

Do you need more help on this, Chris?

Thanks @scale-tone. I uninstalled the extension, reinstalled it, and then tried with the updated connection string the first time and it was able to connect successfully.

So the root issue seems to be connection string caching.

DfMon might cache the connection string from your local.settins.json

I was running DfMon outside the context of a function app, so there was no local.settings.json. I was putting the connection string directly into the command palette.

Debugged this a bit.
DfMon uses its own SqlClient instance to perform certain operations, e.g. getting the list of Task Hubs.
It must have something to do with Microsoft.Data.SqlClient version being used (in DfMon's case it is 5.0.0, as of now), but indeed the accepted local SQLExpress connection string is a bit different in DfMon's case, compared to regular MSSQL-backed Function.
The following connection string worked for me: Server=localhost;Database=MyDatabase;Trusted_Connection=True;Encrypt=False;
Encrypt=False flag was essential.

When using the Durable Functions Monitor command in Command Palette and first entering an invalid connection string, what it took me to make it work was:

  1. Detaching the pending backend(s):
  2. Reusing the same Durable Functions Monitor command, now with a correct connection string.

And anyway, whatever you enter as a connection string there will then appear under Stored Connection Strings node:

and is fully manageable from there.

Hope this can now be closed. You know where to find me, if anything else is missing :)