HubSpot plugin - handle invalid blog author references - #688
Open
djohalo2 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the HubSpot plugin’s blog sync to tolerate unexpected invalid/missing blogAuthorId references by treating “author not found” (404) as non-fatal and falling back to HubSpot’s authorName value (last updater) when the linked Blog Author cannot be resolved.
Changes:
- Extend
PluginErrorto optionally carry an HTTP status code. - Include HTTP status in request failures and treat blog-author 404s as “missing author” rather than a hard error.
- Filter out invalid/missing
blogAuthorIdvalues before fetching authors, and ignore any unresolved authors during sync.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugins/hubspot/src/PluginError.ts | Adds optional status to PluginError for downstream error handling (e.g., 404 detection). |
| plugins/hubspot/src/api.ts | Propagates HTTP status on failed requests; updates fetchBlogAuthor to return undefined on 404 and request archived authors. |
| plugins/hubspot/src/blog.ts | Filters invalid author IDs and safely handles missing authors when building the author ID → name map. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request gracefully handles invalid blog author references on a post and fallbacks to last updated by. According to HubSpot this shouldn't be possible and they enforce that a blog post must have a valid blog author. However, #687 surfaced that for at least one user this data integrity is not guaranteed and a 404 could happen.
Changelog
Testing