question

Dinesh R. avatar image
Dinesh R. asked ·

Issue downloading Cordova JSAgent

Hi,

I am trying to set up monitoring for our hybrid mobile application built on Cordova. Configured the app in dynatrace portal, downloaded the config file, installed dynatrace cordova plugin and trying to build the app.

I see the following error in my logs

Could not download the JSAgent! - Could not download agent options403

Can anyone shed some light? Am I missing any other configuration step?

Plugin version: "dynatrace-cordova-plugin": "^7.2.4-1004"

mobile monitoring
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Juan D. avatar image
Juan D. answered ·
@Matthias H.

I uninstall the older version of plugin and install the new version.... Don´t ask me how but the project build succesfully! Yesterday try and try. Maybe the first install with the new version of plugin was incomplete.

Thank you so much

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Juan D. avatar image
Juan D. answered ·

Hello @Matthias H. Yes, I am using easyTravel example. I download this plugin cordova plugin add dynatrace-cordova-plugin@7.0.6-1002 --save

I try install the last plugin cordova plugin add dynatrace-cordova-plugin --save.

However, the build fall because the dtAgent.js don´t is located in the path. With the plugin 7.0.6-1002 the dtAgent.js is located in the path, but the problem is the path of APK, how you say.

What can I do?

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Ohh. The 7.0.6-1002 is just an example how you could possibly download older versions. But in fact you should always get the newest if possible. So failing build because of JSAgent is the error we should look at (with the newest version) - How does your output look like?

0 Likes 0 · ·
Juan D. avatar image
Juan D. answered ·

Great! now is working... However, I have the next problem:

#ERROR [2019-05-08 22:40:08]: File not available: /Users/c02rk1lcg8wp/Documents/easyTravel-Ionic-master/plugins/dynatrace-cordova-plugin/scripts/../../../platforms/android/build/outputs/apk

File not available: /Users/c02rk1lcg8wp/Documents/easyTravel-Ionic-master/plugins/dynatrace-cordova-plugin/scripts/../../../platforms/android/build/outputs/apk

Can you help me? @Dinesh R. @Matthias H.

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

This error looks like it happens during the Android build. The path to the APK is wrong. I saw you are using the easyTravel Example? Did you check out the current project? Because this other path only happens when you use old plain Cordova projects. So something mixed up here a bit. That's why he is search in ..android/build.. and not in ..android/app/build..

0 Likes 0 · ·
Dinesh R. avatar image
Dinesh R. answered ·

@Juan D.

Manage the permission of your API token under settings -> Integration -> Dynatrace API. For this specific scenario the token needs to have "Real user monitoring JavaScript tag management" permission,

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Juan D. avatar image
Juan D. answered ·

Hello, Where I can find the Javascript tag managment permission. I have same issue @Matthias H. @Dinesh R.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Dinesh R. avatar image
Dinesh R. answered ·

Okay, got it. That explains the error. I went ahead and added the Javascript tag management permission to the token that was auto created. That fixed the issue.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Matthias H. avatar image
Matthias H. answered ·

Okay. Looked it up. It seems like there was a bug which was fixed already but will come with 169. It seems that the token is create but without the needed permissions. The Workaround is to create a token yourself under the settings of the environment. As already said, this will be fix with an update.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Matthias H. avatar image
Matthias H. answered ·

The Cordova Plugin during build tries to download the JavaScript agent, which will then automatically be included in your index.html. This download process failed. Because of a very short message "403". If you look the error code 403 up, you will find that this means access is forbidden. Within your dynatrace.config file you have to specify for the JSAgent username and password. I assume the user and password is not allowed to download the agent.

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Hi @Matthias H. , I have downloaded the dynatrace.config file from SaaS portal -> Applications -> Our Mobile App ->Mobile app settings -> Instrumentation page.
This config file has a token, which I presume should by default need to have the appropriate access. Do you know if there are any specific instructions in configuring the JSAgent?

0 Likes 0 · ·