cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy failed. Detail: get X-CSRF-Token failed: VSCode

ashish_kumar2905
Participant
0 Kudos

Hi,

I am getting error while deploying MDK using VSCode:

Deploy failed. Detail: get X-CSRF-Token failed:

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

ashish.kumar2905

Can you share information on below:

  • Are you deploying to Mobile services cloud foundry or Neo?
  • Did you already set adminAPI and appId parameters in mdk.mobileservice object in the Settings.json?
  • Did you get prompt to enter your user name and password?
  • Suggesting you open the SAP mobile services cockpit URL in a private/incognito window and verify if you are able to access the cockpit with same credentials
  • Do you have custom IdP configured in your BTP subaccount? OR are you using default IdP?

ashish_kumar2905
Participant
0 Kudos

Hi jitendra.kansal ,

  • I am deploying to cloud foundry
  • Yes, I already set the adminAPI and appID
  • Yes, I am getting the prompt and entering the valid credentials
  • Using default idp.

I have few questions:

  • What is bundlerPath?
  • DebungAppRoot ?

While debugging also, I am getting error :

Error processing "launch": Failed to get the bundle result from application: /Users/ashishkumar/Downloads/MDKCLNT23808P_2-80008652/MDKClient_SDK/SaravanaPrinter.mdkproject/metadata/Application.app

screenshot-2023-12-21-at-60853pm.png

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

ashish.kumar2905

I just tested, deployment to cloud foundry works fine for me.

Could you open the SAP mobile services cockpit URL in a private/incognito window and verify if you are able to access the cockpit with the same credentials you used in VSC?

ashish_kumar2905
Participant
0 Kudos

Yes , I am able to login.

Accepted Solutions (0)

Answers (2)

Answers (2)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Looking at this screenshot, your email address is linked to two accounts. This is where you see options to select an account when accessing Mobile services cockpit in browser. This UI window is currently not available in VSC, hence, you can't pick an account while deploying MDK metadata to your mobile services. We'll enhance this in future.

Are those both accounts are S-user and P-user? When you deployed from VSC, did you provide the email address linked to your universal ID OR P/S-user ID? It should work with user ID (i tested with my Universal Id which has two accounts linked to it, deployment works fine when providing my P-user instead of email address).

You can of course continue your development if above works for you. However, i suggest you using MDK tools CLI to deploy your metadata to mobile services. Once you have the BTP org and space set, you don't need to enter credentials anymore.

Please do the following:

  • Install npm install @sap/mdk-tools -g
  • In terminal, navigate to your metadata project root folder
  • Run CF login -a <CF API endpoint> --sso (you can find API endpoint in BTP subaccount page)
  • get the temporary code
  • set org & space
  • run mdk deploy --target mobile if you have .project.json file in your metadata OR
  • run mdk deploy --target mobile --name <your mobile services app ID>
oliver_kaluscha3
Participant
0 Kudos

Hi,

as a workaround: you can do the deployment manually. Inside the settings of MDK plugin, you find

Mdk: Create Upload Bundle Zip

Please check the relevant checkbox. While building on a mac, you find a file called uploadBundle.zip a the following location:

/Users/<username>/.vscode/extensions/sapse.vsc-extensions-mdk-<version>/tools

The correct location is shown at the end of your build process in vscode as well.

So open the update section inside your app on mobile service in BTP and upload this file. Deploy it and it will be available for all users.

This gives you more control, as you can store these ZIP files as versions in GIT and you can deploy the same file on all instances.

Hope that helps.

ashish_kumar2905
Participant
0 Kudos

It is still throwing same error.

And while I am trying to debug, getting another error:

While debugging also, I am getting error :

Error processing "launch": Failed to get the bundle result from application: /Users/ashishkumar/Downloads/MDKCLNT23808P_2-80008652/MDKClient_SDK/SaravanaPrinter.mdkproject/metadata/Application.app