Skip to main content
Question

HTTPS authentication error


Forum|alt.badge.img

Hi Hub, 

The recent weeks we have noticed an inconsistent authentication error with our deployed Cognite Functions. Seemingly, with no apparent reason, a function call fails with a https authentication error when trying to log into microsoft (see call log below). 

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /3b7e4170-8348-4aa4-bfae-06a3e1867469/oauth2/v2.0/token (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f8dee0070d0>: Failed to resolve 'login.microsoftonline.com' ([Errno -3] Temporary failure in name resolution)"))

The error is attributed to our first client call in our code, 

for events in client.events()

where we loop over chunks of events.

 

Have anyone experienced something similar, and know the cause of the error? 

 

Thanks in advance.​​​​,

Vetle.

6 replies

Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img

Hi ​@Vetle Nevland, can you please check whether your firewall is blocking the authentication? You can try to whitelist the Azure AD URL "login.microsoftonline.com" from your firewall in case of restricted internet connection. Whitelisting login.microsoftonline.com:443 might work if this is a firewall issue.


Forum|alt.badge.img
  • Author
  • Committed
  • 11 replies
  • January 28, 2025

Ok, thank you ​@Mithila Jayalath. I’ve sent request to IT support in our org, hopefully they can assist us on this. Will keep you updated.


Forum|alt.badge.img
  • Author
  • Committed
  • 11 replies
  • January 30, 2025

Unfortunately, they cannot assist us in this case. However, I do find it weird that the firewall blocking is the root cause, as the error occurs quite irregularly and rather seldom. I would expect the firewall to block this domain every time a request is made (i.e., every Cognite Function call). Do you have any other suggestions?


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img

@Henrik Eiding Any idea regarding this issue?


  • Practitioner
  • 10 replies
  • February 4, 2025

Is it happening on every invocation of the same function, or is the function sometimes working? 

What CogniteClient are you using in the code? Do you create your own one, or use the client parameter from the deployed handle function? The included client should already have the right token, so there should be no need to try to authenticate with microsoft. It looks like your code is trying to initiate a login flow.

def handle(client, data):
    ....

 


Forum|alt.badge.img
  • Author
  • Committed
  • 11 replies
  • February 25, 2025

@Dag Brattli Most of the function calls succeed. But I think you’re close to the root here, as we indeed create our own client within the handle function. That is, we use both the client provided as input to the handler, including another client created within (we need two different clients, as we read and write to two different CDF projects). Do you think instantiating a new client within the handle function could cause the error?

 

We have had a period now where we have not observed the issue, though. So hopefully it is resolved, or just a really seldom case.


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings