Passer au contenu

WAF bot control javascript integration in React

0

Hi. Has anybody been successful in implementing WAF integration in React pages? I'm told there isn't a npm package, but due to the way we're building I'm getting a not defined errors. We're trying out Bot Control and integrating it with javascript SDK. But we're having trouble comiling our application. We use React to make our web app.

I have added <script> section as instructed in documentation and tried to replace fetch call with AwsWafIntegration.fetch However I get an error:

ReferenceError: AwsWafIntegration is not defined

And my code: const response = await AwsWafIntegration.fetch(url, config)

demandé il y a 4 ans2,3 k vues

2 réponses
0

Hi Artur,

re-checked based on your information and I built a small demo that works without such error. I would advice to check the Console page of your browser's inspect feature and see if there are any errors showing up.

AWS

répondu il y a 4 ans

0

Hi Artur - perhaps you are using Typescript? I managed to get this working adding a declaration in a .d.ts file. The typing matches exactly fetch's usual typing.

  declare namespace AwsWafIntegration {
    declare function fetch(
      input: RequestInfo | URL,
      init?: RequestInit | undefined
    ): Promise<Response>;
  }

répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.