umbraco / Umbraco.Forms.Integrations

MIT License
7 stars 13 forks source link

Our services aren't available right now #31

Closed Sven883 closed 2 years ago

Sven883 commented 2 years ago

Hello ! We're using the latest version of the hubspot integration package (v2.0.0) on a umbraco v8.14.1 installation with umbraco forms v8.12.2. We are able to add the hubspot workflow + successfully connecting with oAuth + map the fields with hubspot properties.

On form submit it takes a while loading, afterwards we receive this screen: image

We created a simple form with name, email and a message field. image

And our hubspot connection: image

Any idea what could cause this issue? Thanks in advance!

acoumb commented 2 years ago

Hi @Sven883 , Could you tell me if you still encounter this issue? I have tested the package on Umbraco 8, as well as with the newly released version 3.0.0 targeting Umbraco 10/.NET6, and could not replicate it. Also you have mentioned that after the form is submitted you received the message Our services ... , and I cannot identify a workflow use case which might cause this. Thanks, Adrian

Sven883 commented 2 years ago

Hey @acoumb, we still encounter this issue. When submitting the page locally, the page just keeps loading until there is a timeout. The timout triggers the 'our services are currently not available' message from our azure cdn.

Any idea why the call after submit cannot complete? Any way to debug this?

acoumb commented 2 years ago

Hi, @Sven883 , I will test again various use cases trying to replicate this.

Sven883 commented 2 years ago

@acoumb, I think it has something to do with the oAuth authentication. When I disconnect & reconnect it works as expected.

Will there be an option in the future to work with a private app instead of oAuth as an extra option regarding this post from hubspot? https://developers.hubspot.com/changelog/upcoming-api-key-sunset

acoumb commented 2 years ago

Currently there isn't a plan for this, we will be managing the access through the public Umbraco app https://app-eu1.hubspot.com/ecosystem/25171316/marketplace/apps/marketing/cms/umbraco-forms-457256

Sven883 commented 2 years ago

@acoumb - When trying to re-authorize using oAuth we get this error: Could not retrieve authenticate with HubSpot API. Status code: BadRequest, reason: Bad Request, content: {"status":"BAD_AUTH_CODE","message":"missing or unknown auth code","correlationId":"38a59151-0e50-4d9a-a90f-2d6354985c47"}

Any idea why?

Sven883 commented 2 years ago

@acoumb I've been investigating a little bit further. I've noticed that when the forms returns a 500 after 30-60 seconds the endpoint GetContactPropertiesAsync or PostContactAsync never get hit.

Something is going wrong in between the submit and the call to hubspot integration.

acoumb commented 2 years ago

And this only happens only you are submitting the form? I am just trying to identify the use case that throws this exception.

Sven883 commented 2 years ago

Yes, this only happens when we submit the form with the hubspot workflow.

acoumb commented 2 years ago

Are you using a particular network setup locally or on the hosting environment, maybe VPN or a proxy, anything that could block the connection?

Sven883 commented 2 years ago

@acoumb no, there is no particular network setup locally. I've changed 2 lines of code and it seems to have fixed the problem:

1 (add configure await) in 'GetResponse': case AuthenticationMode.OAuth: requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await GetOAuthAccessTokenFromCacheOrRefreshToken(authenticationDetails.RefreshToken).ConfigureAwait(false)); break;

2 (add configureawait) in 'GetOAuthAccessTokenFromCacheOrRefreshToken' // No access token in the cache, so get a new one from the refresh token. await RefreshOAuthAccessToken(refreshToken).ConfigureAwait(false);

Sven883 commented 2 years ago

@acoumb I noticed a new version (v3.0.0) has been added. What has changed between v2.0.0 & 3.0.0?

acoumb commented 2 years ago

Version 2.0.0 is for Umbraco 8/.NET 4.7.2. Version 3.0.0 is for Umbraco 10/.NET 6.

I will update the packages and release new versions with the fix you mentioned.

Sven883 commented 2 years ago

@acoumb Thank you! Could you ping me here when the fix is released?

acoumb commented 2 years ago

@Sven883 the new versions (2.0.1/3.0.1) are now live. Many thanks for your assistance and help on this, let me know how it goes now.

Sven883 commented 2 years ago

@acoumb Thanks! I'll get back to you when we've tested v2.0.1.

Sven883 commented 2 years ago

@acoumb We've upgraded to the newest version (v2.0.1) and the problem seems to be solved! Thanks for the quick reaction and release!

acoumb commented 2 years ago

@acoumb We've upgraded to the newest version (v2.0.1) and the problem seems to be solved! Thanks for the quick reaction and release!

Sounds great, thank you also for helping out!