Tracking prevention access blocked for office.js – excel add-in

enter image description here

When loading my excel add-in, I see that office.js gets blocked from the edge browser inside of excel, see screenshot. How to prevent this from happening? I tried to time my script loading different, but that didn’t help. This causes my custom functions not being registered properly anymore.

taskpane.html

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>title</title>
    <link rel="icon" href="../assets/favicon.ico">

       
    <!-- Modified Office.js loading -->
    <script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>
    <link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css"/>
  
    <!-- Load other scripts after Office.js -->
    <script type="text/javascript" src="../functions/functions.js"></script>
    <script type="text/javascript" src="taskpane.js"></script>

I played around with delays and more, but I actually have no idea how to fix this. Any help would be much needed, I’m willing to donate 10 € in crypto for the solution. The problem is not limited to one machine, but appears in VM, Excel in Edge browser and Excel desktop, multiple devices.

Different script loading or delays, either same behavior or broken add-in loading.

JS/C Interop with zig cc and wasm

I am writing a webassembly demo in C to match a similar demo I wrote in zig.

I am currently able to call C functions from JS, and interact with shared memory on either side. However, I can’t seem to be able to expose JS variables and functions to the C program.

Is anybody familiar with writing C this way? I wonder if the undefined symbols are getting optimized out somehow.

I’m using zig cc (i.e. clang) to compile to wasm on zig version 0.13.0-dev.351+64ef45eb0, using clang 16.0.0 on macos Sequoia 15.0.1 (aarch64).

This is the code I’ve written thus far:

resource.c

#include <stdlib.h>

void print_test(void); // the function I want to use

const unsigned char heap[4096];

int __attribute__((export_name("memstart")))
memstart() {
    return (int)&heap;
}

int __attribute__((export_name("return5")))
return5(int p) {
    return 5 * p;
}

int __attribute__((export_name("entryAt")))
entryAt(int p) {
    print_meme();
    return heap[p];
}

index.html


<!DOCTYPE html>
<html lang="en">
    <head>
        <title>For Stephen</title>
    </head>

    <body>
        <input id="input" type="number" placeholder="int param..."></input>
        <input id="bytes" placeholder="bytes..."></input>
        <pre id="output">output goes gere</pre>
        <button id="button_r5">Return 5</button>
        <button id="button_nth">Get nth byte</button>
        <canvas id="my_canvas"></canvas>
        <script>
            const c = {};
            const encoder = new TextEncoder();
            const decoder = new TextDecoder();

            const importObject = {
                "env": {
                    "print_test": () => console.log("test print")
                }
            };

            WebAssembly.instantiateStreaming(fetch("resource.wasm", importObject))
            .then(result => {
                const {memory, memstart, return5, entryAt} = result.instance.exports;
                console.log(memstart);
                c.buffer  = new Uint8Array(memory.buffer, memstart());
                c.return5 = return5;
                c.entryAt = entryAt;
            });

            const button_r5  = document.getElementById("button_r5");
            const button_nth = document.getElementById("button_nth");
            const input  = document.getElementById("input");
            const bytes  = document.getElementById("bytes");
            const output = document.getElementById("output");

            button_r5.addEventListener("click", ()=>{
                output.textContent = c.return5(input.value);
            });

            button_nth.addEventListener("click", ()=>{
                c.buffer.set(encoder.encode(bytes.value));
                output.textContent = c.entryAt(input.value);
            });
        </script>
    </body>

</html>

Build command

zig cc -target wasm32-freestanding -g resource.c -lc -Wl,--no-entry -o resource.wasm

How to display an array of values ​in a table with javascript

I’m trying to display the array into a table according to my expectations, but I’m having problems breaking down the sub-subs in the array, I want to display the contents of the array according to the table header, because it seems like it’s looping.. hope someone can help

This is my HTML code :

<div class="table-responsive mt-3">
  <table id="tablemx" class="table table-border mb-0" style="border: 1px solid black;">
    <thead class="table-dark">
      <tr>
        <td>Status</td>
        <td>Main</td>
        <td>Name</td>
        <td>Class</td>
      </tr>
    </thead>
    <tbody></tbody>
  </table>
</div>

This is my Javascript code :

const arrs = [{
        "type": "Student",
        "datas": [
            { "name": "Rian", "class": 4 },
            { "name": "Jhon", "class": 4 },
            { "name": "Alex", "class": 4 },
            { "name": "Rudi", "class": 7 },
            { "name": "Brain", "class": 7 }
        ]
    }
];

const tablemx = document.getElementById("tablemx");
const arrssub = arrs[0].datas;
const dnsmxchild = Object.values(arrssub);
dnsmxchild.forEach((item, index) => {
  const tr = document.createElement("tr")
  const td1 = document.createElement("td")
  const td2 = document.createElement("td")
  const td3 = document.createElement("td")
  const td4 = document.createElement("td")
  const type = document.createTextNode("Student")
  const main = document.createTextNode("roll")
  const name = document.createTextNode(item)
  const classs = document.createTextNode(item)
  td1.appendChild(type)
  td2.appendChild(main)
  td3.appendChild(name)
  td4.appendChild(classs)
  tr.appendChild(td1)
  tr.appendChild(td2)
  tr.appendChild(td3)
  tr.appendChild(td4)
  tablemx.appendChild(tr)
})

this is the result of my experiment, and it is still wrong. :

Wrong Result

and this is the result I expected :

result I expected

Web component – Shadow DOM get selection

I’m building my own web component. And I’m using shadow dom to do it. I know that using document.getSelection() I can get the selected text, but I would need to do it in shadow dom. However, the shadow dom object doesn’t even contain this method and more importantly it shouldn’t be used. More info here – shadowRoot.getSelection()?

My point is that I want to get the selected text in shadow dom and wrap it with a span that will have the background set to yellow. The attached code finds the selected text, but adds the span to the body not to the shadow dom. Is there any solution to do this?

I’ve really tried a lot of options and article/discussions on the subject and I can’t find anything much.

boldButton.onclick = () => {
  const selection = document.getSelection();
  if (!selection || selection.rangeCount === 0) return;

  const range = selection.getRangeAt(0);

  const span = document.createElement("span");
  span.style.backgroundColor = "yellow";

  range.surroundContents(span);
};

Thanks

Using Mockoon Instead of MockAPI – POST Request Not Working

I’m following a tutorial that uses MockAPI to create a mock backend. However, since MockAPI now limits the number of resources in free projects (the tutorial was recorded before this limitation), I switched to Mockoon instead. Unfortunately, my POST requests to the Mockoon server are failing, and I’m not sure why.

When using MockAPI, my POST request works fine:

class User {
    user_id = '';
    username = '';
    email = '';
    api_url = 'https://679fe3e324322f8329c4d911.mockapi.io/api/v1';

    create() {
        let data = {
            username: this.username,
            email: this.email,
            password: this.password
        };        

        data = JSON.stringify(data);

        fetch(this.api_url + '/user', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: data
        })
        .then(response => response.json())
        .then(data => {
            console.log('User created');
        })
        .catch(error => console.error(error));
    } 
}

However, when I switch to Mockoon, it does not work:

class User {
    user_id = '';
    username = '';
    email = '';
    api_url = 'http://localhost:1269';

    create() {
        let data = {
            username: this.username,
            email: this.email,
            password: this.password
        };        

        data = JSON.stringify(data);

        fetch(this.api_url + '/users', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: data
        })
        .then(response => response.json())
        .then(data => {
            console.log('User created');
        })
        .catch(error => console.error(error));
    } 
}

With MockAPI, my POST request works correctly, but when I switch to Mockoon, I get the following errors in the browser console:

  • POST http://localhost:1269//users 404 (Not Found)
  • Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

What I’ve Tried:

  • Double-checked that Mockoon is running on port 1269.
  • Verified that the endpoint /users exists in my Mockoon API configuration.
  • Tried changing /users to /user, /api/users, and other variations.
  • Checked the Mockoon logs to see if the request is reaching the mock server.

Possible Causes (Need Help!):

  • Is there a specific way Mockoon expects API endpoints to be set up?
  • Does Mockoon handle POST requests differently than MockAPI?
  • How do I define response structures in Mockoon similar to MockAPI’s automatic mock data?

Any help would be greatly appreciated!

Can i disappear the save report button from action menu in interactive report in oracle apex?

I have an interactive gride page. i want to hide SAVE button in action menu to prevent user to save report as default or primary report
i have tried to do that using page item be hidden contain value = Y and make dynamic action on it execute JavaScript code. this is the code

function(config) {
  config.initActions = function( actions ) {
    $(() => {
      if ( $v("P3_NEW") === "Y" ) {
        apex.region("todo").widget().interactiveGrid("getActions").hide("save-report");
        apex.region("todo").widget().interactiveGrid("getActions").hide("show-save-report-as-dialog");
        apex.region("todo").widget().interactiveGrid("getActions").hide("show-edit-report-dialog");
      }
    });
  }
  return config;
}```
Can anyone help me to do this in interactive gride and also in interactive report?

VS Code Extension API – bizzare javascript behaviour

I have a normal js file for vscode extension api. When debugging, js seems to be broken (I know, impossible). Here is my code …

context.subscriptions.push(
  vscode.commands.registerCommand("stickyBookmarks.toggleBookmark", 
    () => {
      const textEditor = vscode.window.activeTextEditor;
      if (!textEditor) return;

      const document   = textEditor.document;
      const lineNum    = document.lineCount-1;

      const textLine   = document.lineAt(lineNum-2);
      const lineRange  = textLine.range;

      const rgtChrIdx  = lineRange.end.character;
      const lftChrIdx  = rgtChrIdx-4;

      // debugger breakpoint here
      const lftPos     = new vscode.Position(lineNum, lftChrIdx);
      const rgtPos     = new vscode.Position(lineNum, rgtChrIdx);
      const chrRange   = new vscode.Range(lftPos, rgtPos);
      const text       = document.getText(chrRange);

      if(text === "/**/") textEditor.edit(
        editBuilder => editBuilder.replace(chrRange, ""));
    }
  )
);

At the breakpoint rgtChrIdx == 14 and lftChrIdx == 0. I have tried a breakpoint on every line. Does anyone have any idea what is going on?

How to Update Node Positions in Drawflow After Applying Dagre Layout?

I’m working on a diagram editor built with Drawflow, and I’m experimenting with Dagre to automatically arrange the graph.

I’m successfully computing new positions for the nodes using Dagre, but when I update Drawflow’s node positions (node.pos_x = pos.x; node.pos_y = pos.y;), the changes are not reflected on screen.

I’ve searched through Drawflow’s documentation and source code, but I can’t find a way to force an update to the display so that the nodes visually move to their new positions, while keeping their connections.

Here’s my current function:

function applyDagreLayout(drawflow) {
  const nodes = drawflow.drawflow.drawflow.Home.data;
  const graph = new dagre.graphlib.Graph();
  graph.setGraph({ rankdir: 'LR', nodesep: 50, edgesep: 20, ranksep: 80 });

  // Add nodes to Dagre
  for (let key in nodes) {
    graph.setNode(key, { width: 100, height: 100 });
  }

  // Add edges to Dagre
  for (let key in nodes) {
    const node = nodes[key];
    if (node.inputs) {
      for (let input in node.inputs) {
        const sourceNode = input.node;
        if (sourceNode) {
          graph.setEdge(sourceNode, key);
        }
      }
    }
  }

  // Compute new layout
  dagre.layout(graph);

  // Update node positions in Drawflow
  for (let key in nodes) {
    const node = nodes[key];
    const pos = graph.node(key);

    node.pos_x = pos.x;
    node.pos_y = pos.y;

    console.log(`Updated node ${key} position to:`, node.pos_x, node.pos_y);
    
    // Attempted fixes (None of these work so far)
    // drawflow.moveNode(key, pos.x, pos.y); // Is what I'd like to do ideally, but it doesn't exist
    // drawflow.removeNodeId(key);
    // const newNode = drawflow.addNode({ ...node }); // Deleting the node and creating a new one with the same data might work, but then I'll have to create its connections again, and it can introduce other problems as well since the node's id will technically not be the same, I'd rather avoid this and do it the 'proper' way, if such a thing exists in this library
  }

  // Tried reloading the editor, but this caused there to be duplicate nodes (the new nodes didn't have any connections)
  // drawflow.load();
}

What I’ve Tried:

  • Directly modifying node.pos_x and `node.pos_y.
  • Searching for a function like moveNode(), update(), or refresh() in Drawflow.
  • Removing and re-adding nodes using removeNodeId() and addNode().
  • Calling drawflow.render() to force a redraw.

Question:

How can I update the Drawflow canvas to reflect the new node positions after applying the Dagre layout?

JQuery function does not work after asyncpostback

I am trying to create a JQuery DatePicker Asp.Net ServerControl

To atach a datepicker to a TextBox I am creating a JQuery line of code from c# code behind and output it directly to the webpage using ClientScript.RegisterStartupScript()

So if for example there are 3 instance of the DatePicker control with ids: dpfa,dpar,dpen
then the script being rendered will be:

<script type="text/javascript">
//<![CDATA[
;jQuery(function($){$('#dpfa').datepicker({dateFormat:'yy/mm/dd',regional:'fa'}).change(function(){validateDatepicker(this,1);});});
;jQuery(function($){$('#dpar').datepicker({dateFormat:'yy/mm/dd',regional:'ar'}).change(function(){validateDatepicker(this,1);});});
;jQuery(function($){$('#dpen').datepicker({dateFormat:'yy/mm/dd',regional:''}).change(function(){validateDatepicker(this,1);});});
//]]>
</script>

Everything works fine except for when I put the datepickers inside an asp.net updatepanel and make an ajax call after the asyncpostback the JQuery functions do not work and the datepickers are not attached to the textboxes.

This is what I tried so far:

I tried to put the scripts on the onclick event of the DatePicker (wich extends asp.net TextBox control) as follows:

1- When I do it this way:

onclick=";jQuery(function($){$('#dpfa').datepicker({dateFormat:'yy/mm/dd',regional:'fa'}).change(function(){validateDatepicker(this,1);});});"

the datepicker is attached to the textbox but it does not popup and I need to leave the control and click on it again for it to show.

2- I tried to debug some javascript when I came up to the following script that attaches the datepicker to the textbox and shows it on the first click but as you can see an alert will also popup wich is not a good thing and should not happen:

onclick=";jQuery(function($){$('#dpfa').datepicker({dateFormat:'yy/mm/dd',regional:'fa'}).change(function(){validateDatepicker(this,1);});});alert('hi');"

What is the alert causing? and can it’s behavior be resambled by calling another dummy function but without showing any popups?

My main question: How can I modify the above jQuery functions to work after async postbacks?

random delays in services [closed]

I’m working on a model of high-rise building activities where services represent typical floor operations. I’d like to introduce random delays in each activity, affecting roughly one in five floors. the no.of floors in the building is 100. Can you please help with suggestions on how best to implement this?

i have tried file:///C:/Program%20Files/AnyLogic%208.8%20Personal%20Learning%20Edition/plugins/com.anylogic.ui_8.8.6.202312140457/resources/help/en/anylogic/stochastic/random-number-generator.html#random-number-generator, but did understand how to use this

What queues actually exist in the event loop

Most sources say that there are two queues in the Event Loop: microtask queue and macrotask queue. But also some sources highlight the third queue (callbacks generated by requestAnimationFrame) and the fourth (callbacks generated by requestIdleCallback). How many queues are there actually, or is this just an implementation detail that may differ from browser to browser?

Create array of values from a dictionary of array of objects filtered by property

I have a dictionary where key is string and value is array of objects:

objDict = {
  dataset1: [ { id: 1, count: 6 }, { id: 2, count: 7 }, { id: 3, count: 8 } ],
  dataset2: [ { id: 1, count: 5 }, { id: 2, count: 4 }, { id: 3, count: 3 } ]
}

I need to filter objects with specific id and create an array of count values: for id = 2 it would be countArray = [ 7, 4 ].
I suppose I should first use Object.values(objDict) but I don’t know what to do afterwards.

JS/NodeJS module exporting class from nested directory

I’m new to writing custom JS modules even if I use it occasionally for both work and personal project.

At the moment I managed to write a module (let’s call it my-module) that export a default class (DefaultClass), i.e. in my dist/index.js I have

// dist/index.js
import DefaultClass from "./default-class";

export {DefaultClass};

To test it correctly I set up a local Verdaccio registry, publish my module to it and then import it in a second test project.
In this test project I can use DefaultClass as follow:

import { DefaultClass } from "my-module";

const instance = new DefaultCLass;

So far so good.

I then added some other classes that I nested in dist/subfolder/ with the related dist/subfolder/index.js that exports them:

// dist/subfolder/index.js
import SubClassA from "./subclass-a";
import SubClassB from "./subclass-b";
import SubClassC from "./subclass-c";

export {
    SubClassA,
    SubClassB,
    SubClassC,
};

What I’m trying o do is to be able to import those classes in the test project directly/explicitly (is this the right word?) as follows:

import { SubClassA } from "my-module/subclass";

Just to be even more clear, the desired behaviour is the same as the AWS CDK that lets import only the desired submodule: e.g. for the Amplify module the given example is
import * as amplify from 'aws-cdk-lib/aws-amplify';

It may be not relevant, but for the sake of being as clear as possible, my module source code is in src/ and then I use esbuild with a config file to build both src/index.js and src/subfolder/index.js and output the boundles to dist/.

At the moment, I get the error

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to//test-project/node_modules/my-module/subfolder' imported from /path/to/test-project/index.mjs

I’m having trouble changing the audio source of an audio player I found here on StackOverflow

So, I found an audio player here on StackOverflow that uses youtube links, and I wanted to use it on my website so I didn’t need to put any audio files on it (the server that I use don’t handle audio and video files in their free version). It was made by Max Zheng, the code can be found here: How to play only the audio of a Youtube video using HTML 5?; and is composed of a css code, a javascript code, and a html code.

The idea I had was to have a list of youtube links on the code, for the user to change the song by clicking on the “next” and “previous” buttons

Here is the code I have made so far, with the buttons, links and the audio player included:

<html>
<head>
  <meta charset="UTF-8">
    <link rel="stylesheet" >
    <script src="https://www.youtube.com/iframe_api"></script>

    <script>
      function onPlayerReady(event) {
          document.getElementById(ui.play).addEventListener('click', togglePlay);
          timeupdater = setInterval(initProgressBar, 100);
      }
      
      function onPlayerStateChange(event) {
          if (event.data == YT.PlayerState.ENDED) {
              document.getElementById(ui.play).classList.remove('pause');
              document.getElementById(ui.percentage).style.width = 0;
              document.getElementById(ui.currentTime).innerHTML = '00:00';
              player.seekTo(0, false);//change here the false to true if you want your audio to loop automatically
          }
      }
      
      let ui = {
          play: 'playAudio',
          audio: 'audio',
          percentage: 'percentage',
          seekObj: 'seekObj',
          currentTime: 'currentTime'
      };
      
      function togglePlay() {
          if (player.getPlayerState() === 1) {
              player.pauseVideo();
              document.getElementById(ui.play).classList.remove('pause');
          } else {
              player.playVideo();
              document.getElementById(ui.play).classList.add('pause');
          }
      }
              
      function calculatePercentPlayed() {
          let percentage = (player.getCurrentTime() / player.getDuration()).toFixed(2) * 100;
          document.getElementById(ui.percentage).style.width = `${percentage}%`;
      }
      
      function calculateCurrentValue(currentTime) {
          const currentMinute = parseInt(currentTime / 60) % 60;
          const currentSecondsLong = currentTime % 60;
          const currentSeconds = currentSecondsLong.toFixed();
          const currentTimeFormatted = `${currentMinute < 10 ? `0${currentMinute}` : currentMinute}:${
          currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds
          }`;
          
          return currentTimeFormatted;
      }
      
      function initProgressBar() {
          const currentTime = calculateCurrentValue(player.getCurrentTime());
          document.getElementById(ui.currentTime).innerHTML = currentTime;
          document.getElementById(ui.seekObj).addEventListener('click', seek);
      
          function seek(e) {
              const percent = e.offsetX / this.offsetWidth;
              player.seekTo(percent * player.getDuration());
          }
          
          calculatePercentPlayed();
      }
      
      var a = "jLdAuGarfM0"; //infinita highway
      
      var b = "M7lc1UVf-VE"; 
      
      var c = "glbmprjG3zw"; //hai yorokonde
      
      var d = "p6NzVd3pGdE"; //instambul
      
      var e = "2rHRztFGOm8";
      
      let teste = "37nwLhIA1zs";
      
      let shitpost = "i6l8MFdTaPE";
      
      let techto = e;
      

        function onYouTubeIframeAPIReady() {
            player = new YT.Player('player', {
                height: '360',
                width: '640',
                videoId: id_video,
                events: {
                    'onReady': onPlayerReady,
                    'onStateChange': onPlayerStateChange
                }
            });
        }
        
        
    </script>
  </head>
  <body>
    <!--Youtube-->
    <div id="player" style="display: none; visibility: hidden;"></div>
    
    <!--Player-->
    <p id="nome_musica"></p>
    
    <div class="audio-player">
        <div class="player-controls">
            <div id="radioIcon"></div>
            <button id="playAudio"></button>
            <div id="seekObjContainer">
                <div id="seekObj">
                    <div id="percentage"></div>
                </div>
            </div>
            <p><small id="currentTime">00:00</small></p>
        </div>
    </div>
    <button id="tras" >Previous Song</button>
    <button id="frente" >Next Song</button>
    <button id="bug"> FUNCIONE DESGRAÇA</button>
    <p>Song number</p>
    <p id="x"> </p>
    <script>
      var xe = 1;
      //var id_video = "jLdAuGarfM0";
      //var id_video = a;
      var inicio = checkin(xe);
      
      document.getElementById("tras").onclick = function() {bottras()};
      document.getElementById("frente").onclick = function()  {botfrente()};
      //document.getElementById("bug").onclick = function()  {onYouTubeIframeAPIReady()};  <----- NÃO
      
      function botfrente(){
        yg = xe + 1;
        if (yg >=4){
          var yg = 1;
          checkin(yg);
          return xe = yg;
        }else{
          checkin(yg);
          return xe = yg;
        }
        document.getElementById("x").innerHTML = xe;
      }
      
      function bottras(){
        yg = xe - 1;
        if (yg <= 0) {
          var yg = 3;
          checkin(yg);
          return xe = yg;
        }else{
          checkin(yg);
          return xe = yg;
        }
      }
      
      function checkin(z){
        document.getElementById("x").innerHTML = z;
        if (z == 1) {
          document.getElementById("nome_musica").innerHTML = "Engenheiros do Hawaii - Infinita Highway (ao vivo)";
      //substitute the text above with the name of the song
          id_video = a;
      //substitute the variable with your song
        }else if (z == 2){
          document.getElementById("nome_musica").innerHTML = "They Might Be Giants - Istambul(not Constantinople)";
          id_video = d;
        }else if (z == 3){
          document.getElementById("nome_musica").innerHTML = "Kocchi no Kento - Hai Yorokonde";
          id_video = c;
        }else{
          document.getElementById("error").innerHTML = "error in the system"
        }
      }
      
        
        
      
    </script>
  </body>
</html>

The links are working, and the buttons are working as well, but they don’t change the source of the song after being determined when the code starts working.
Can someone please help me determine how do I change the audio source after the code starts?

How to burn erc20 token with web3js?

I am trying to burn erc20 token and get this error:
ContractExecutionError: Error happened while trying to execute a function inside a smart contract
at Function._isReverted (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:328:19)
at Web3RequestManager._processJsonRpcResponse (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:280:42)
at Web3RequestManager. (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:167:29)
at Generator.next ()
at fulfilled (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:21:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: [Eip838ExecutionError: execution reverted] {
cause: undefined,
code: -32000,
receipt: undefined,
data: undefined
},
code: 310,
receipt: undefined
}

Here is my code:

const tokenContract = new web3.eth.Contract(ERC20_ABI, tokenInfo.address, {
    from: account,
    gasPrice: '20000000000'
  });
tokenContract.methods
    .burn(stringAmount)
    .send({
      from: account,
      chainId: chainId,
      value: 0,
      gasPrice,
    })
    .on("transactionHash", (hash) => {
      console.log('hash', hash);
    })

Some one help me plsssss !!!