<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Upload fails when initiated from a C# webAPI (only) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759034#M33167</link>
    <description>&lt;P&gt;I am able to upload files all day long using the following code, so I know it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  try
                {
                    var uploaded = await dbx.Files.UploadAsync(
                    folder + "/" + fileName,
                    //.WriteMode.Overwrite.Instance,
                    body: mem);

                    sharedLinkArg = new Dropbox.Api.Sharing.CreateSharedLinkArg(folder + "/" + fileName);
                    var link = await dbx.Sharing.CreateSharedLinkAsync(sharedLinkArg);

                    sharedLink = link.Url;
                }
                catch (AggregateException ex)
                {
                    SessionHelper.LogErrors("attachhelpers", ex.ToString(), "UploadFile", "system");
                    return sharedLink;
                }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I call it from a webAPI, it fails silently. This means it won't work from our mobile app, which uses the webAPI. It's working for website users.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't catch any errors using 'catch (AggregateException ex).' I have been trying different ways of calling it all day long (async/await, task/task.Result).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried different ways to log errors. I know logging from an async method has issues, so what works?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From my logging that does work, everything seems to be fine all the way up until that Try/Catch block, then it fails with no way of knowing what happened. Nothing ever worked locally, so I'm trying to debug from a live server, which doesn't help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Searching, it looks like there used to be error logs on the Dropbox side. I am not able to locate these anywhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any tidbit here that might point me in the right direction? What's different about the webAPI than if a user is on the website pressing a button?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Failing that, anyone want to suggest a better way for me to catch errors from that Try/Catch block. I'm getting nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 16:48:29 GMT</pubDate>
    <dc:creator>jay-8</dc:creator>
    <dc:date>2024-03-21T16:48:29Z</dc:date>
    <item>
      <title>Upload fails when initiated from a C# webAPI (only)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759034#M33167</link>
      <description>&lt;P&gt;I am able to upload files all day long using the following code, so I know it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  try
                {
                    var uploaded = await dbx.Files.UploadAsync(
                    folder + "/" + fileName,
                    //.WriteMode.Overwrite.Instance,
                    body: mem);

                    sharedLinkArg = new Dropbox.Api.Sharing.CreateSharedLinkArg(folder + "/" + fileName);
                    var link = await dbx.Sharing.CreateSharedLinkAsync(sharedLinkArg);

                    sharedLink = link.Url;
                }
                catch (AggregateException ex)
                {
                    SessionHelper.LogErrors("attachhelpers", ex.ToString(), "UploadFile", "system");
                    return sharedLink;
                }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I call it from a webAPI, it fails silently. This means it won't work from our mobile app, which uses the webAPI. It's working for website users.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't catch any errors using 'catch (AggregateException ex).' I have been trying different ways of calling it all day long (async/await, task/task.Result).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried different ways to log errors. I know logging from an async method has issues, so what works?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From my logging that does work, everything seems to be fine all the way up until that Try/Catch block, then it fails with no way of knowing what happened. Nothing ever worked locally, so I'm trying to debug from a live server, which doesn't help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Searching, it looks like there used to be error logs on the Dropbox side. I am not able to locate these anywhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any tidbit here that might point me in the right direction? What's different about the webAPI than if a user is on the website pressing a button?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Failing that, anyone want to suggest a better way for me to catch errors from that Try/Catch block. I'm getting nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 16:48:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759034#M33167</guid>
      <dc:creator>jay-8</dc:creator>
      <dc:date>2024-03-21T16:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Upload fails when initiated from a C# webAPI (only)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759136#M33172</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;I can't catch any errors using 'catch (AggregateException ex).' ...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Did you try catching Dropbox.Api.DropboxException or some its derivative exception? 🧐 &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 00:50:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759136#M33172</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2024-03-22T00:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Upload fails when initiated from a C# webAPI (only)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759224#M33176</link>
      <description>&lt;P&gt;No. Are there any examples of that anywhere?&lt;/P&gt;&lt;P&gt;Is this still a thing??? It would be helpful. Can't find anything like this now:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dropbox.tech/developers/debug-your-dropbox-app-with-app-error-logs" target="_blank" rel="noopener"&gt;https://dropbox.tech/developers/debug-your-dropbox-app-with-app-error-logs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did finally get something to work. The working code on a web form could start out as a void or async void and worked (The onclick event on a web form can't return anything, so it has to be a void). However, pretty much the same code on a webAPI would not work. I had to make the webAPI async and return a task. Then I had to await the call to the dropbox code. This actually got a file from the server into Dropbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Part of the deal here is that I don't need to actually return anything in this. Since it worked when a user was pressing a button, it seemed like it should work when called from the webAPI. That apparently wasn't the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And that was compounded by not getting any errors anywhere in the process. Everything seemed to work all the way up to the await dbx.Files.UploadAsync(...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 13:24:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759224#M33176</guid>
      <dc:creator>jay-8</dc:creator>
      <dc:date>2024-03-22T13:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Upload fails when initiated from a C# webAPI (only)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759233#M33177</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;No. ...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;However you want... but try it. 🤷 It wouldn't bit you. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@D88F213CAFB196B6AB70612B08AD9D31/emoticons/1f601.png" alt=":beaming_face_with_smiling_eyes:" title=":beaming_face_with_smiling_eyes:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;... Can't find anything like this now:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dropbox.tech/developers/debug-your-dropbox-app-with-app-error-logs" target="_blank" rel="noopener"&gt;https://dropbox.tech/developers/debug-your-dropbox-app-with-app-error-logs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As far as I know such features are dropped and no more supported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;... Everything seemed to work all the way up to the await dbx.Files.UploadAsync(...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Did you try dump 'uploaded' variable's content?! &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@9AD39CA637682E9616FBE31CDAF1B6C4/emoticons/1f914.png" alt=":thinking_face:" title=":thinking_face:" /&gt; If there is any error, it would be there (or if no error - uploaded file metadata). Something else: Keep in mind that if no WriteMode set and when you try upload to existing file (i.e. try overwrite) - this is error! Do you do such thing?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 14:02:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759233#M33177</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2024-03-22T14:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Upload fails when initiated from a C# webAPI (only)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759251#M33182</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1815484"&gt;@jay-8&lt;/a&gt; Dropbox no longer provides error logs like that for the API. We recommend debugging issues like this locally. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, we can't provide support for third party platforms themselves, so I can't say what may be different about your different environments, but as Здравко said, every Dropbox API call should either return a result or raise an exception. If you're having trouble catching or handling the result/exception programmatically, I suggest stepping through with a debugger to see what is happening first.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 15:16:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-fails-when-initiated-from-a-C-webAPI-only/m-p/759251#M33182</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2024-03-22T15:16:11Z</dc:date>
    </item>
  </channel>
</rss>

