I'm running the PlayFabPowerTools source code within Visual Studio. When migrating cdn files all seems to work well up until file upload to the target title. All I get is 403 Forbidden. Any leads?
I'm running the PlayFabPowerTools source code within Visual Studio. When migrating cdn files all seems to work well up until file upload to the target title. All I get is 403 Forbidden. Any leads?
Looks like the issue about the 403 error you are having derives from this code:
PlayFabPowerTools uses the WebClient class to handle file upload/download, however, it doesn’t set the contentType for the file about to upload in the headers, leaving them empty. During execution, the contentType will be set as the default value: “application/octet-stream”, which might be a problem. I set up a test to upload a png file to CDN using the code above, if I don’t add the contentType corresponding to my file, which is “image/png”, I will get the “403 forbidden” error like you did, however, if I add the contentType using this code:
client.Headers.Add("Content-Type", "image/png");
my file will get uploaded successfully.
I will report this issue to the related team to investigate, thanks for your feedback.
Meanwhile, you might want to consider re-writing corresponding code to make it specify contentType before uploading, or migrate CDN files manually, really sorry for this inconvenience.
Thank you for the quick reply. Thanks to you I've managed to make it work for our json files too.
I forked the repo and are fixing this (adding support for a few basic file types based on file extension) and a few other things. In the process now of making cloud script migration work more as you'd expect. The current way the tool migrates cloud script is by taking the latest (published or not) revision from the source title and immediately publishing it live on the target title (!). Recipe for destruction...
If I'm happy with the code in the end I might make a pull request.
Yes, I can confirm the cloud script migrating issue you are talking about, I will report this to the corresponding team, thanks for your feedback:)
4 People are following this question.