APIs & Integrations

StaffG
Participant

Import file async API (v3) never finishes

SOLVE

Hi,

I am having problems getting files/v3/files/import-from-url/async to work.

I am trying to import a file from a URL (URL tested working from several different devices).

I get a 202 from the request

 

https://api.hubapi.com/files/v3/files/import-from-url/async

 

with the following body:

 

{
  "id":"AAAACg4_sPM",
  "links": {
    "status":"https://api-eu1.hubspot.com/files/v3/files/download-from- 
    url/AAAACg4_sPM/status"
  }
}

 

Which leads me to believe that the request I correct and I have the necessary permissions/scopes. However, calling the status link

 

https://api.hubapi.com/files/v3/files/import-from-url/async/tasks/AAAACg4_sPM/status

 

for updates on the status returns:

 

{
  "completedAt":"2021-08-13T11:34:43.870Z",
  "startedAt":"2021-08-13T11:34:13.022Z",
  "links":{
    "status":"https://api-eu1.hubspot.com/files/v3/files/download-from-url/AAAACg5WIPc/status"
  },
  "taskId":"AAAACg4_sPM",
  "status":"PROCESSING"
}

 

Repeated requests to the same endpoint continue to return status PROCESSING for several minutes and eventually I get the response:

 

{
  "status": "COMPLETE",
  "numErrors": 1,
  "errors": [
    {
      "status": "error",
      "category": "INTERNAL_SERVER_ERROR",
      "message": "Error downloading file: FAILED_UPLOAD"
    }
  ],
  "startedAt": "2021-08-13T09:59:12.955Z",
  "completedAt": "2021-08-13T10:39:30.738Z",
  "taskId": "AAAACg4_sPM"
}

 

And I am stuck. Can anyone help with that error message or point me in the right direction, I have searched the community and internet but not found anyone with a similar problem.

Can I get more information about the error from HubSpot, some log or something?

 

I am using Oauth and and have succesfully obtained an accesstoken that is used in the request.  The accesstoken is to a Test Account  in this case but I have also tested it with a Free account with the same result. I have also tested uploading to the same account from the "playground" on the Files API documentation page with the same result.


Thanks in advance!
Staff

0 Upvotes
1 Accepted solution
StaffG
Solution
Participant

Import file async API (v3) never finishes

SOLVE

I was misstaken in my previous post, the change we made that made it work again was that we changed from trying to upload to the root directory to instead upload to a named directory.

View solution in original post

4 Replies 4
dennisedson
HubSpot Product Team
HubSpot Product Team

Import file async API (v3) never finishes

SOLVE

@StaffG ,

Are you still experiencing this issue?

@webdew have you seen anything like this?

0 Upvotes
StaffG
Participant

Import file async API (v3) never finishes

SOLVE
Yes, it still occurs. Tomorrow I will try with the sync version of upload as a workaround and to possibly give some more insight.
StaffG
Participant

Import file async API (v3) never finishes

SOLVE

Hi again,

 

I managed to solve this on our end. I believe that the "problem" was that we requested (refreshed) the access token between the upload of the file and the status request. When fixing our implementation of OAuth so it does not refresh the access token unnecesarily the problem went away. 

 

It would be nice however if the error message said something about access token or that it was possible to see a log with more information to be able to trouble shoot API integrations better.

 

Closing with this as solution.

StaffG
Solution
Participant

Import file async API (v3) never finishes

SOLVE

I was misstaken in my previous post, the change we made that made it work again was that we changed from trying to upload to the root directory to instead upload to a named directory.