Developer Q&A Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Call to App Function Fails With An "Execution crashed" Error

skirkham
Participant

We are considering the use of App Functions to provide standardised and simplified approach to certain datasets, however the test platform that I've set up (simple app and notebook module) isn't working. Most of this basic setup is either taken from the docs or the helpers.

The app was created using the app creator and has the following details:
AppId = my.data.builder

and the App Function (again created through the app creator) is as basic as...

export default function () {
  return "This Worked";
}

... with a name of "getDashboardData"


The notebook JavaScript module has the following script

import { functions } from '@dynatrace-sdk/adhoc-utils';

const response = await functions.call('my.data.builder', 'getDashboardData', {}).then((res) => res.text());
 
However, we I run this I get a "Execution crashed" exception and details of...
{
  "error": {
    "code": 540,
    "message": "Execution crashed.",
    "details": {
      "logs": "Error: Function getDashboardData within the app my.data.builder failed\n at file:///opt/sdk_modules/@dynatrace-sdk/adhoc-utils@1/esm/index.js:30:13\n at eventLoopTick (ext:core/01_core.js:177:7)\n at async Object.call (file:///opt/sdk_modules/@dynatrace-sdk/adhoc-utils@1/esm/index.js:22:20)\n at async file:///script.ts:3:18\n",
      "type": "UNCAUGHT_EXCEPTION",
      "message": "Uncaught (in promise) Error: Function getDashboardData within the app my.data.builder failed",
      "details": {
        "lineNumber": 30,
        "startColumn": 13,
        "stack": "Error: Function getDashboardData within the app my.data.builder failed\n at file:///opt/sdk_modules/@dynatrace-sdk/adhoc-utils@1/esm/index.js:30:13\n at eventLoopTick (ext:core/01_core.js:177:7)\n at async Object.call (file:///opt/sdk_modules/@dynatrace-sdk/adhoc-utils@1/esm/index.js:22:20)\n at async file:///script.ts:3:18"
      }
    }
  },
  "packageVersions": {
    "@dynatrace-sdk/adhoc-utils": "1.0.2"
  }
}

 

Clearly, I've missed something somewhere - would you be able to point me in the right direction please?

Thanks

 

7 REPLIES 7

doesterr
Dynatrace Helper
Dynatrace Helper

Hi skirkham,

I see two different app IDs: my.data.builder and my.cwv.data.builder.

Please double-check that you're actually using the correct app ID when calling your function.

Cheers,
David

Thanks for the heads up David, however it is the same error message from both sources.

I initially created a more functional AppFunction (which tests fine within VSCode) but as I received the error I created a new app and the more simplified AppFunction just to make sure it wasn't within the code.

Is there any permissions needed for allowing AppFunctions?

 

Hello @skirkham 

Yes, there is a specific permission for running App Functions.

Please check whether the user running the Notebook has at least:

ALLOW app-engine:apps:run;
ALLOW app-engine:functions:run;

Or assign the built-in/default AppEngine - User policy, which already includes:

ALLOW app-engine:apps:run, app-engine:functions:run, app-engine:edge-connects:read;

app-engine:functions:run is the important one because it enables the App Function executor.

That said, if the permission were completely missing, I would normally expect more of an authorization/permission error. Since your error says the function “failed” and returns code 540, it may also mean the function is being reached but crashing inside the App Function runtime.

Max Lopes

Hi,

Thanks for the detail, I have checked and the user does already have those permissions and I agree that if it were related to permissions I should see a different error message.

I'll drop a ticket into support.

Thanks


Hello @skirkham,

Yeah should be, but sometimes errors are omitting details like missing permissions, I learned in the worst way... almost 1 week by missing one specific scope 😅

Max Lopes

skirkham
Participant

For anyone else seeing this issue...

A quick conversation with support identified the issue which was due to the application been deployed in development mode, which runs code locally and therefore my notebook wasn't able to connect to the app function, hence the error. However, once the app was fully deployed then the notebook was able to call the function and return the required data.

Thank you for sharing what the issue was!

Featured Posts