Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.16 no longer recognizes the EU API endpoint in FriendlyCaptchaSDKOptions #33

Closed
kevin-m-as opened this issue Jan 29, 2025 · 4 comments

Comments

@kevin-m-as
Copy link

Previously (in version 0.1.15) a widget could be created as follows:

    const sdk = new FriendlyCaptchaSDK({
      apiEndpoint: 'eu',
    });

    widget.value = sdk.createWidget({
      element: ...,
      sitekey: ...,
    });

As of version 0.1.16 this fails with the following error:

Anti-Robot check failed to connect to page or https://global.frcapi.com Check your connection and try again.

However, the following version does appear to work correctly:

    const sdk = new FriendlyCaptchaSDK();

    widget.value = sdk.createWidget({
      apiEndpoint: 'eu',
      element: ...,
      sitekey: ...,
    });

I'm not sure if this is an intended change in functionality and the documentation hasn't caught up, or if something is indeed broken.

@greenberga
Copy link
Contributor

Hi Kevin, thanks for reporting this. Indeed, this looks like a regression that may have been caused by a bugfix shipped in 0.1.16. I'll dig further and hope to have a solution released by early next week at the latest.

@greenberga
Copy link
Contributor

Hey Kevin, I looked into this a bit. I believe there is a subtle bug where if you specify the apiEndpoint in the SDK constructor (as in your first code block), it won't actually be used when creating the widget. I.e., if you specify eu in the SDK constructor, the widgets will be created using the global endpoint. I'm unable to reproduce the error message you're seeing though. You can see this behavior in this CodePen:

https://codepen.io/ajgreenb/pen/jENJxwj

Is there a way you could share an example that demonstrates the error message you're encountering?

@kevin-m-as
Copy link
Author

My apologies, it turns out the error message was due to our rather strict CSP which was disallowing connections to the global endpoint.

@kevin-m-as
Copy link
Author

Confirmed the expected behavior in 0.1.17, thanks for your attention to this matter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants