# Using 3rdparty modules in js runtime.

**URL:** <https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674>\
**Category:** Developer Q&A Forum\
**Tags:** custom-app, workflows, app-functions\
**Created:** [January 17, 2024, 6:40pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674 "2024-01-17T18:40:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DantePaoloni](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@DantePaoloni](https://community.dynatrace.com/u/DantePaoloni)\
**Post date:** [January 17, 2024, 6:40pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674/1 "2024-01-17T18:40:52Z")

</div>

Hello development team!

The last time I read about JS runtime limitations, I remember the ability to import third-party modules for use in applications and/or workflow tasks. Reading again, [JavaScript runtime | Dynatrace Developer](https://developer.dynatrace.com/reference/javascript-runtime/) seems like there is much more limited support for importing third party modules.

My use case is to use cheerio to extract information from a scrap via fetch and send the value to a metric. Is something like that not possible? Since the moment that I call the cheerio function I get the following error:

_ **An error occurred: {“code”: 541, “message”: “Execution crashed.”, “details”: {“type”: “BAD\_REQUEST”, “message”: “\<stripped secret anyhow::Error\>”}}** _

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [January 18, 2024, 1:10pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674/2 "2024-01-18T13:10:31Z")

</div>

Hi&nbsp;[@DantePaoloni](https://community.dynatrace.com/user/70651)

Yes the JS runtime has some limitations when it comes to 3rd party modules.

I have tried to reproduce your problem. loading data via fetch and using cheerio to extract it. This is my code snippet, it works without any problems

```markup
import * as cheerio from "cheerio";

export default async function (payload: unknown = undefined) {
  const resp = await fetch("https://example.com/");
  const txt = await resp.text();
  const $ = cheerio.load(txt);
  console.log($("title").text());
  return $("h1").text();
}

```

Maybe you can share your AppFunction code with us?

Best,  
Sini

---

<div class="post-metadata">

**Author:** ![michal\_zawislak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/michal_zawislak/32/13613_2.png) [@michal\_zawislak](https://community.dynatrace.com/u/michal_zawislak)\
**Post date:** [January 18, 2024, 1:29pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674/3 "2024-01-18T13:29:02Z")

</div>

If I’m interpreting the error[@DantePaoloni](https://community.dynatrace.com/user/70651)&nbsp; shared correctly, he might be using the “Run Javascript” action in Workflows, which currently doesn’t support 3rd party libraries.

---

<div class="post-metadata">

**Author:** ![DantePaoloni](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@DantePaoloni](https://community.dynatrace.com/u/DantePaoloni)\
**Post date:** [January 18, 2024, 1:53pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674/4 "2024-01-18T13:53:27Z")

</div>

Hey, I was re checking again just in case. Indeed is a JS Action in a workflow.

Will eventually be supported? Or this is be something to create in&nbsp; an AppFunction and call it throught a workflow like in&nbsp;[Create and consume app function | Dynatrace Developer](https://developer.dynatrace.com/develop/functions/create-function/#from-notebooks-or-workflows)&nbsp;? Im asking in this case the “right” way to handle it.

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [January 18, 2024, 2:00pm UTC](https://community.dynatrace.com/t/using-3rdparty-modules-in-js-runtime/43674/5 "2024-01-18T14:00:47Z")

</div>

Yes, as of now that would be the workaround.

There have been plans to add 3rd packages support for functions in workflows and notebooks but I don’t have any further details on that.
