# Error when calling an AppFunction in a CustomApp

**URL:** <https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565>\
**Category:** Developer Q&A Forum\
**Tags:** dynatrace-app-toolkit, custom-app, app-functions\
**Created:** [May 14, 2024, 10:42am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565 "2024-05-14T10:42:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 14, 2024, 10:42am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/1 "2024-05-14T10:42:31Z")

</div>

Hello my friends!

I’m getting an error when I try to call an AppFunction on my custom App, I have already created and used AppFunctions, but I am having this error in a new App, I will put the error log below:

 ![MaximilianoML_0-1715683242601.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/a/7abb61745546b6b2b351693cfce577a1f167bd9d.png)

I don’t know if it’s just a missed config or something that I did wrong, thank you for your help. 🙂

---

<div class="post-metadata">

**Author:** ![SarahFaustmann](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@SarahFaustmann](https://community.dynatrace.com/u/SarahFaustmann)\
**Post date:** [May 15, 2024, 7:15am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/2 "2024-05-15T07:15:39Z")

</div>

Hi&nbsp;[@MaximilianoML](https://community.dynatrace.com/user/73851),

Thanks for reaching out. Can you let us know which versions of Node.js and the Dynatrace App Toolkit you’re using? You should be on the [latest LTS of Node.js and the latest version for the toolkit](https://developer.dynatrace.com/develop/troubleshooting/troubleshoot-connectivity-issues/#install-the-latest-version). You could also try to delete the node\_modules folder and follow up with an “npm install”. Let us know if this helps.

Best,  
Sarah

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 15, 2024, 1:01pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/3 "2024-05-15T13:01:09Z")

</div>

Hello,&nbsp;[@SarahFaustmann](https://community.dynatrace.com/user/67610),

First, thank you for your support!

Okay, I’ll try to update my Node to the latest LTS version and then delete the Modules, when I have the results I will let you know.

Thank you again 🙂

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 17, 2024, 2:30pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/4 "2024-05-17T14:30:31Z")

</div>

Hello,&nbsp;[@SarahFaustmann](https://community.dynatrace.com/user/67610)&nbsp;!

I apologize for the delayed response, I updated the Node to the LTS version but the problem persists, I will attach an image that shows the error (which also occurs during the deployment attempt).

 ![MaximilianoML_0-1715956212768.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/6db801e1185ecd01f2a4d445ed74ebcbc600ebfb.png)

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 20, 2024, 8:29am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/5 "2024-05-20T08:29:39Z")

</div>

I also got these errors when running the local server.

 ![MaximilianoML_0-1716193713152.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/d/4d290cad563581703568564fca49055effa5bb16.png)

---

<div class="post-metadata">

**Author:** ![PennyScully](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pennyscully/32/32029_2.png) [@PennyScully](https://community.dynatrace.com/u/PennyScully)\
**Post date:** [May 21, 2024, 8:34am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/6 "2024-05-21T08:34:07Z")

</div>

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

Given your receiving a 401 error, the next best practice would be to check if you have the required permissions within your environment. This will need to be changed in the IAM policies:&nbsp;[https://docs.dynatrace.com/docs/manage/access-control/manage-user-permissions-policies/iam-policy-mg…](https://docs.dynatrace.com/docs/manage/access-control/manage-user-permissions-policies/iam-policy-mgt)

You can also read more about&nbsp;[AppEngine Policies in this blog.](https://www.dynatrace.com/news/blog/tailored-access-management-part-2-onboard-users-to-grail-and-appengine/?_ga=2.189966509.782318418.1715584917-1215566356.1702976290&_gac=1.156313033.1715664055.CjwKCAjw9IayBhBJEiwAVuc3fhT9vM_1eCMVP2m8m6rJefCOBgDBuweWD6DGvrR587vLnbcPpzx0HBoC4VwQAvD_BwE)

If your not able to do this you may need to contact your Dynatrace Admin to help you set this up. Hope this helps.

Thanks, Penny

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 21, 2024, 8:40am UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/7 "2024-05-21T08:40:56Z")

</div>

Hello,&nbsp;[@PennyScully](https://community.dynatrace.com/user/49766)&nbsp;!

Actually I already have the permission to do, because I’ve developed a custom App with no problems, and this morning I tried to call my App Function and worked but to deploy doesn’t work.

But since last week I’m getting these erros.

Thank you again! 🙂

---

<div class="post-metadata">

**Author:** ![imsingh](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imsingh/32/7858_2.png) [@imsingh](https://community.dynatrace.com/u/imsingh)\
**Post date:** [May 22, 2024, 1:58pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/8 "2024-05-22T13:58:44Z")

</div>

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

What is the error message you’re getting when deploying? The one that you sent before?

If yes, that’s perhaps the issue with your authentication. Could be number of reasons such as auth token expired and so on.

Can you provide more details?

Thanks

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 22, 2024, 2:05pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/9 "2024-05-22T14:05:13Z")

</div>

Hello&nbsp;[@imsingh](https://community.dynatrace.com/user/52863)&nbsp;!

Yeah, about this problem I already opened a ticket so we don’t need to look into this… but about my AppFunction is not working again and I definitely didn’t change anything… I don’t know what’s happening.

My Node is the LTS Version and I already deleted and run npm install again and no results.

 ![MaximilianoML_0-1716386548704.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/0/00fc31bd334a3d2a3082520cfefd37037db7ab1e.png)

---

<div class="post-metadata">

**Author:** ![imsingh](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imsingh/32/7858_2.png) [@imsingh](https://community.dynatrace.com/u/imsingh)\
**Post date:** [May 22, 2024, 2:07pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/10 "2024-05-22T14:07:32Z")

</div>

Is it possible to share a redacted version of your app function? If not, I think going to support is the right approach if you can’t share your things publicly.

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [May 22, 2024, 2:11pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/11 "2024-05-22T14:11:21Z")

</div>

I can, it’s just a Fetch and return.

 ![MaximilianoML_0-1716387037680.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/2/a249cc33cdaea43fa40f0c04f5bfb93d7db79d2a.png)

---

<div class="post-metadata">

**Author:** ![imsingh](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/imsingh/32/7858_2.png) [@imsingh](https://community.dynatrace.com/u/imsingh)\
**Post date:** [May 22, 2024, 4:04pm UTC](https://community.dynatrace.com/t/error-when-calling-an-appfunction-in-a-customapp/45565/12 "2024-05-22T16:04:03Z")

</div>

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

The issue that you have is with authentication and that’s the reason for having issue with seriazling data and also when deploying.

I think support is the right thing to do. However, if you want to pinpoint the issue, you can remove the functionality of this app function and deploy the app. Most likely you’ll be able to deploy.

Also, check the token value. Is it valid, does it have required permissions?
