Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deploy with Hubspot API v3 #393

Merged
merged 2 commits into from
Sep 1, 2023
Merged

Conversation

marshallswain
Copy link
Member

Hubspot’s v2 api was not returning all pages when we requested them. We were not hitting the limit. It appears to be a bug that they fixed in v3 of their API. The bug was causing some pages to be re-created even though they already existed. Hubspot was appending an integer for a while then began appending a timestamp to avoid overwriting the existing page. Looking at the timestamps of the published pages, this has been a problem since December 2020, and 80 copies of each erroring page have been mistakenly published.

I tested the code on the learn-docker pages and it successfully updated the files. Before publishing the entire site, I’m going to let somebody else take a look and run the code.

There was some previous work done to say how many pages need to be deleted. I updated the code to log the slug of each duplicate/orphaned page, which shows the pages that end in timestamps (Hubspot duplicate prevention). We will need to make another PR to delete the orphaned pages.

I haven't run the script to fix the other broken files, yet. We need to do that after review/merge.

Improves debuggability of some code, as well.

Hubspot’s v2 api was not returning all pages, even though we were not hitting the limit.  This was causing some pages to be re-created even though they already existed.  Hubspot was appending an integer for a while then began appending a timestamp to avoid overwriting the existing page.  Looking at the timestamps of the published pages, this has been a problem since December 2020, and 80 copies of each page have been mistakenly published.

I tested the code on the `learn-docker` pages and it successfully updated the files.  Before publishing the entire site, I’m going to let somebody else take a look and run the code.

There was some previous work done to say how many pages need to be deleted.  I updated the code to log the slug of each duplicate/orphaned page, which shows the pages that end in timestamps (Hubspot duplicate prevention).  We will need to make another PR to delete the orphaned pages.

Improves debuggability of some code, as well.
@justinbmeyer
Copy link
Member

This looks good to me. Can you run it and merge tomorrow? I will be able to test it after.

I don't see a script to clean up? Is that in another PR?

Thanks!

Modifies the publish script to…

- log the page slug in the “Update Success” message, since slugs give more context than page titles.
- log which files were deleted from Bitovi.com
- comment out the delete process until manually verified by another developer.

One line will need to be uncommented after verifying that the list of files to be deleted is correct.
@marshallswain
Copy link
Member Author

@justinbmeyer, I added a few lines to enable deletion of old pages. The logging was been updated to list the slugs that were published and the slugs that the script "think" need to be removed. I've left it commented out until the pages to be removed are verified.

Here's the line to uncomment once the pages are verified.

Also, I ran the publish script and it completed successfully.

@marshallswain marshallswain merged commit e892665 into main Sep 1, 2023
1 check passed
@marshallswain marshallswain deleted the feature/hubspot-api-v3 branch September 1, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants