PTCInc / thingworx-gitbackup-extension

[Unofficial/Not supported] ThingWorx GitBackup Extension for storing your ThingWorx application code in a Git repository
MIT License
25 stars 11 forks source link

Export Data process crashes and never returns a "done" popup #12

Closed AlessandroNicoli closed 3 years ago

AlessandroNicoli commented 3 years ago

image

When I try to start an export process this is what everytime happens. Seems that this process never ends, or crashes for some reasons but its not shown if it has success or not.

cbadici commented 3 years ago

Hi Alessandro, Exporting the data is a process that can run for a long time depending on how much data you have. Have you verified if the data is actually exported ? I suspect one of the reasons the service is timing out is because it's running longer that the ScriptTimeout setting in platformsettings.json file which is typically 30 or 60 seconds. I will also investigate if it is an UI issue. You can find the related service in the Git.Utility.ThingShape - ExportProjectData

AlessandroNicoli commented 3 years ago

Hi Alessandro, Exporting the data is a process that can run for a long time depending on how much data you have. Have you verified if the data is actually exported ? I suspect one of the reasons the service is timing out is because it's running longer that the ScriptTimeout setting in platformsettings.json file which is typically 30 or 60 seconds. I will also investigate if it is an UI issue. You can find the related service in the Git.Utility.ThingShape - ExportProjectData

Hi, yes the data is correctly exported, and I don't have found any "ScriptTimeout" string in the platformsettings.json, so I expect it tooks the default 30" timeout.

cbadici commented 3 years ago

Can you also let me know what version of thingworx and git extension you are using? You can also test if the service is giving a timeout or an error. Go to your Git backup thing, to services, and execute ExportProjectData service, you just need to input the project name. If you receive a timeout error, you can increase the ScriptTimeout like in this article: https://www.ptc.com/en/support/article/CS314493

AlessandroNicoli commented 3 years ago

I'm using TW 9.0.2 (I've two different instances on 2 different servers and both have this behaviour). The service gives me back this error:

Cattura

cbadici commented 3 years ago

Ok, the service is not correct (at least for version 9) and that's why it is returning an error. I can provide you with a fix for this. First of all you will need to import the attached thingworx blob extension, it will be used to convert a blob to a base64 string Then, go to Git.Utility.ThingShape, and edit ExportProjectData, line 114, where ExportURL variable is defined. Please replace that portion of code with my following code, which will correctly export the project data and provide the task id in a string. Save your service and test again, it should also work from the Mashup and once it is completed, it will produce a popup. var ExportURL = target.baseURL + "/DataExporter?path=" + encodeURIComponent(iftbl_ConfigurationRow.FileRepoPath) + "&repositoryName=" + encodeURIComponent(iftbl_ConfigurationRow.FileRepository) + "&searchTags=" + encodeURIComponent("Applications:" + ProjectName); var params2 = { headers: { "appKey": target.appKey, "Accept": "application/octet-stream" } /* JSON */ , ignoreSSLErrors: true /* BOOLEAN */ , url: ExportURL /* STRING */ }; // result: STRING var str_ExportResult = Resources["ContentLoaderFunctions"].LoadBinary(params2); str_ExportResult = base64DecodeString(Resources["BlobServices"].GetBase64StringValue({blob: str_ExportResult /* BLOB */}));

thingworx-blob-extension (1).zip

AlessandroNicoli commented 3 years ago

Hi, I did it and seems to work like a charm! Anyway, I'll test it better in the next days :)

107712592-f9329480-6cc9-11eb-9199-a0b58a9ebc19

Thanks a lot for the support.