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

This product reached the end of support date on March 31, 2021.

Issue downloading Cordova JSAgent

dinesh_reddy
Newcomer

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"


11 REPLIES 11

matthias_hochri
Dynatrace Pro
Dynatrace Pro

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.


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?


matthias_hochri
Dynatrace Pro
Dynatrace Pro

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.


dinesh_reddy
Newcomer

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.


jduarted
Newcomer

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


dinesh_reddy
Newcomer

@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,


jduarted
Newcomer

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.


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..


jduarted
Newcomer

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?


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?


jduarted
Newcomer
@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