APIs & Integrations

silicium
Member

Problem with updating file via COS Files API

Hello,

Please, see what problem I have.

I have some file in File system.
I have updated this file using this API method:

Upload a replacement file | COS Files API

POST /filemanager/api/v2/files/:file_id

But file content was not updated.
According to this article:

How long do replaced files cache in File Manager?

While replaced files will often update quickly, it's possible they can take up to 2 hours to propagate across the global Content Delivery Network.


File should be updated in 2 hours. I was waiting for about 16 hours, but file is still not updated.

Even if I delete file using this method:

Delete file from the CDN, along with all thumbnails and associated content | COS...

POST /filemanager/api/v2/files/:file_id/full-delete


and upload new file with the same name, file content is still not updated, even after 16 hours.

But, I have found really interesting behavior.
If I change file name in File manager, just adding one more character or symbol, and try opening file with new name, file content is updated. And if I rename file to old name, file content is still old one.

Can anybody explain me what is going on?

Thanks

0 Upvotes
12 Replies 12
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with updating file via COS Files API

Hi @kremenetskyi,

Sure thing; appreciate the patience here. This has been a particularly tricky issue to pin down. It had to do with the CDN changes taking effect in certain domains, but not others. The file-preview domains weren’t updated along with the other domains, which meant that the caches weren’t being cleared. This update is in progress now; caching times for CDN2 links should now reflect the normal ~2 hour max. I’ll post again here when I get confirmation from my team that it’s been complete for the file-preview domain as well.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with updating file via COS Files API

Hi @kremenetskyi,

Sorry for the radio silence here. It appears this caching was due to a complication with some CDN updates that were made recently. While I don’t have a precise timeline, the team is currently working on a fix. I’ll update this thread when I have more information.

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

Hello,

It will be really great, if you can update status here.

Thank you @Derek_Gervais

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with updating file via COS Files API

Hi @kremenetskyi,

Thank you, that’s helpful to have confirmed. As I said before, I’m digging into this with the team now. I’ll be sure to reach out in this topic when I have more information on this issue.

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

Hello

Any news about this issue?

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with updating file via COS Files API

Hi @kremenetskyi,

I’m digging into this with the team now. Based on the examples I’ve been able to produce, I haven’t seen the same behavior, but we’re still working through the behavior. Just to make sure I fully understand the process you’re using:

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

Hello @Derek_Gervais,

Thanks for your attention.
About process:

  1. It doesn’t matter way for uploading file. I uploaded via endpoint: https://developers.hubspot.com/docs/methods/files/post_files. Also, I uploaded file just via File Manager. Results are the same.
  2. Yes, replace via: https://developers.hubspot.com/docs/methods/files/post_files_file_id
  3. Yes.
0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with updating file via COS Files API

Hi @kremenetskyi,

Can you reach back out with a link to a specific file that you’ve seen this behavior with?

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

Now it is updated, after some time (more than 16 hours).

I will update this post with links for new files soon.

silicium
Member

Problem with updating file via COS Files API

Hello,

Please, see this file:
https://app.hubspot.com/file-preview/4022346/file/5539413870/

But seems like you can’t see this file, if you are not logged in system. I don’t know how to show…
If I change content file via API, I see old content.
If I rename this file, content becomes correct (new one).
If I rename to old name, content becomes old (

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

Also, please, see

If I see file like this:
https://app.hubspot.com/file-preview/4022346/file/5539413870/
it is old one
but, if I see the same file here:

DocTest.pdf

84.38 KB


there is new content.

It seems like some problem with CDNs updating.

Could you check?

Thanks.

0 Upvotes
silicium
Member

Problem with updating file via COS Files API

And only now file https://app.hubspot.com/file-preview/4022346/file/5539413870/
is updated
It got about 24 hours…
So pity.

0 Upvotes