Cordova-Publish Error

Hi, I have been trying to get an AR project that I created via the playcanvas editor to build & wrap with Cordova so that I can test it through my own device. I have followed all of the instructions on the Apache Cordova documentation on the PlayCanvas site as well as the Cordova/Rest-API repo on GitHub. I was successfully able to build the project and if I go to the url generated I can download the zip, however when I try to use the url with ‘npm run cordova-publish’ it starts the operation but then I get an error that references the shared.js file located in the cloned repository. I’ve attached a screenshot of the error. I’m wondering if it is an issue with my scene? And if so what the issue might be? Or if in my config.json file I need to update the details in this file such as the scenes, token, name, etc? I am not a seasoned programmer but have been trying to make my way through with the documentation so it is possible that I am overlooking something quite simple. Appreciate any and all help.

Here is the beginning of the code in my config.json file


:

‘’’
// “playcanvas”: {
“project_id”: 9999,
“name”: “Project name”,
“scenes” : [9999],
“branch_id”: “99999999-9999-9999-9999-999999999999”,
“description”: “”,
“preload_bundle”: false,
“version”: “”,
“release_notes”: “”,
“scripts_concatenate”: true,
“scripts_sourcemaps”: false,
“scripts_minify”: true,
“optimize_scene_format”: false
‘’’

Not sure if that’s the exact contents of the JSON as there are missing } and other scopes.

Can you post the exact contents/post a screenshot of all the content in the config.json file please? (minus any sensitive data you don’t want to share)

I would also double check your API token is correct too/create a new one to be sure from your user account settings page.

I’m not sure what you mean by this. What is the URL and how did you use it with npm run cordova-publish?

Hi, I have updated my config.json file to contain all correct project parameters but I do not have access to any .env.template to duplicate and when I run mv .env.template .env there is no file created. I am following the documentation here https://developer.playcanvas.com/en/user-manual/publishing/mobile/cordova/ and here in setup, then under Cordova Publish https://github.com/playcanvas/playcanvas-rest-api-tools#setup

You can see .env.template in the GitHub repo:

And this should be viewable in a Code Editor like Visual Studio Code:

As you are on Mac, if you open the folder in finder, you can press Cmd + Shift + . to show hidden files (https://www.macworld.co.uk/how-to/show-hidden-files-mac-3520878/)

Resolved via email. .env did not have the API token set.