Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

364
Visualizações
Require cycle issue when using BotFramework DirectLine JS with axios

I'm trying to work with Microsoft Bot Framework in react native using DirectLine API. Everything works properly but as soon as I initiate axios GET call I get error

Require cycle: node_modules/core-js/internals/microtask.js -> node_modules/core-js/internals/microtask.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

It only happens when I intialize DirectLine API, if I comment out and remove the DirectLine API, the axios works fine. Both are different APIs, I'm unable to figure out why using DirectLine API is causing the axios to stop working.

Here is the code

import React,{useEffect} from 'react';
import {
  SafeAreaView,
  View,
  TouchableOpacity,
} from 'react-native';

import { DirectLine } from "botframework-directlinejs";

var directLine

const App = () => {

  useEffect(()=>{
    directLine = new DirectLine({
        secret: "XXXXX"
    });
    directLine?.activity$.subscribe(botMessage => {
      alert("BotMessage")
    });
  },[])

  const onSend = () => {
  let msgPayload = {
    from: { id: 'abc', name:'human'},
    type: 'message',
     text: "Hello" 
  }
      directLine.postActivity(msgPayload).subscribe(() => console.log("success"), () => console.log("failed"));
  };
  
  const onApiSend = () => {
  const axios = require('axios').default;
  axios.get('https://api.github.com/users/mapbox')
  .then((response) => {
    alert("Api Called Success")
  });
  }

onApiSend only works if I remove the useEffect (DirectLine JS) part. Otherwise I get error related to Require cycle

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The issue is in the BotFramework DirectLine JS library and in order to make it work in react native, the library needs to be rebuild (both lib and dist) folder with minor change. The github repo should be forked and the line in BotFramework-DirecLineJS/src/directLine.ts should be changed from

import 'core-js/features/promise';

to

import 'core-js/modules/es.promise.finally';
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda