Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

363
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!