Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

362
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda