내용으로 건너뛰기

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년 전2.3천회 조회

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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠