cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using node modules in Apps

r_weber
DynaMight Champion
DynaMight Champion

Hello,

I'm trying first steps with building a Dynatrace App. Got a demo app and taking my steps from there, but I have no experience in typescript nor nodejs coding.

I'm trying to use the 'tls' module included in nodejs within an api of my app. So I have this in my api typescript:

 

let tls;
try {
  tls = await import('node:tls');
} catch (err) {
  console.error('tls support is disabled!');
} 

 

When I run that app in the dev server I get an error:

Error: Cannot import module 'node:tls'.

I guess this is a very general question, what is happening here and why are built-in modules not available?

kr

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net
6 REPLIES 6

sinisa_zubic
Dynatrace Champion
Dynatrace Champion

Hi @r_weber 

The Dynatrace JavaScript runtime will provide a compatibility layer for Node.js to improve compatibility with third-party npm packages. This is currently not possible. 

On the page about the Dynatrace JavaScript runtime we will add an section about which node modules will be supported. 

So currently no node modules are available as part of the Dynatrace JavaScript runtime.

Best,
Sini

Actually, there are quite some node modules already supported. The content on https://developer.dynatrace.com/reference/javascript-runtime/ will soon be updated as soon as all changes are rolled out.

However, node:tls won't be supported. @r_weber can you tell me what you want to do with this module?

 

Hi @stefan_eggersto ,

I want to migrate my Advanced SSL Check Plugin to an app. For that I need low level access to TLS.

kr,
Reinhard

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

I just checked various ways to access certificate information, but it seems like this is not yet possible.

I'll ask the team to respond if they plan to allow access to certificate information.

silvio
Dynatrace Advocate
Dynatrace Advocate

Hi @r_weber


We are currently evaluating support for the `node:tls` module.
Could you specify which of the modules APIs you'd need to use?

r_weber
DynaMight Champion
DynaMight Champion

Hi @silvio 

thanks for the update.

As it is with development, sometimes you do not know what you will be needing, only during development things will unfold.

kr

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

Featured Posts