Attempting to delete a user profile returns HTTP response of 504 Gateway Timeout (Java SDK)

  • 1
  • Problem
  • Updated 1 year ago
  • (Edited)
I've been trying to write a subroutine that will take an email address as input and then retrieve its associated user id in ShareFile. Finally, the id is used to delete the user profile permanently.

The logic that retrieves the user id based on the email address is working and not at issue. However, when I try to delete the user from ShareFile I the program hangs and then, after a long period, returns an HTTP response code of "504 Gateway Timeout".

I've tried using the "users().delete(userid).execute();" method.

I've also tried the code below to call the REST API directly. Both give the same response.

This tells me that it is not my code that is at issue. 500 errors are internal server problems.





    private static boolean DeleteShareFileAgentProfile(String p_StrEmail)
    {

        boolean l_ObjResult = false;
              
        //This will catch any errors.
        try {
           
           
            //First get the user profile object.
            SFUser agent = GetUserByEmailAddress(p_StrEmail);
            String l_StrURL = String.format("https://account.sf-api.com/sf/v3/Users(%s)",agent.getId());
           
            //Declare our connection objects.
            URL url = new URL(l_StrURL);
            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
            connection.setRequestMethod("DELETE");
            connection.setDoOutput(true);
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
            connection.addRequestProperty("Authorization", String.format("Bearer %s", m_ObjOAuth2Token.getAccessToken()));
            connection.connect();
           
            int responsecode = connection.getResponseCode();
           
           
           
            l_ObjResult = true;
           
        //Handle any stray errors so that the program doesn't crash.
        } catch (IOException ex) {
                    System.out.print(" Error: " + ex.getMessage());
                    m_StrErrorRecordFeedback = ex.getMessage();
        }
       
        //Return the result.
        return l_ObjResult;
    }
Photo of Daniel Dorpinghaus

Daniel Dorpinghaus

  • 27 Posts
  • 5 Reply Likes
  • Very, very frustrated.

Posted 1 year ago

  • 1
Photo of Daniel Dorpinghaus

Daniel Dorpinghaus

  • 27 Posts
  • 5 Reply Likes
Can someone on the support team comment about why I'm seeing this problem?
Photo of Michael Berrier

Michael Berrier, Official Rep

  • 123 Posts
  • 24 Reply Likes
Hi Daniel,

If the 504 Gateway Timeout is the response from ShareFile, it does imply the issue might not be with your implementation. If you're comfortable sharing, the subdomain or account ID of the ShareFile account you're accessing would help us troubleshoot, as would the IDs of the users that failed to be deleted if you happen to have them. Your application's OAuth client ID (but not the secret) could also be useful. If you'd be willing to share some of these details, feel free to throw them in a file and upload it to this ShareFile request share so you don't need to post them on the public forum:

https://michaelberrier.sharefile.com/r-r4d8b213c3514b11a

In the meantime, I'll see if I can find any general failure trends around user deletion and will share whatever I find.

Michael
Photo of Daniel Dorpinghaus

Daniel Dorpinghaus

  • 27 Posts
  • 5 Reply Likes
Thank you very much Michael! I've uploaded the information you've requested. Many thanks for your assistance!
Photo of Michael Berrier

Michael Berrier, Official Rep

  • 123 Posts
  • 24 Reply Likes
Daniel,

Apologies, but I don't see any file uploaded via that share link. Can you try again? If the link gives you any trouble, I can provide you with another, but either should work:

https://michaelberrier.sharefile.com/r-rd9bfe6841fc42d28

Michael
Photo of Daniel Dorpinghaus

Daniel Dorpinghaus

  • 27 Posts
  • 5 Reply Likes
I've uploaded the info. Thanks!
Photo of Michael Berrier

Michael Berrier, Official Rep

  • 123 Posts
  • 24 Reply Likes
Daniel,

Thanks for providing your info! From our logs, I can see several attempts to delete the user you specified and every attempt appears to be successful from the API's point of view, having returned an HTTP 204 in each case. However, most of your calls took a relatively long time to complete (over a minute in most cases). Is there any chance you are calling into ShareFile from behind a proxy that might be imposing a short timeout?

Also, is your intent to completely remove the user from the account? The call you are currently making will not remove the user entirely, but instead simply disable their folder access. If you intend to fully delete the user, you should supply the query string parameter "completely=true" on your call to DELETE sf/v3/Users(id) -- it should also be exposed as a parameter in the SDK for your convenience. It's possible this will yield a performance improvement for you as well, since in some cases this is actually a less expensive mode of deletion from ShareFile's point of view.

Michael