跳至内容

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)

已提问 4 年前2335 查看次数

2 回答
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

已回答 4 年前

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>;
  }

已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。