Skip to content

fix: linkedin sync broken due to apify schema changes#889

Merged
ramiAbdou merged 3 commits into
mainfrom
rami/apify
Jan 12, 2026
Merged

fix: linkedin sync broken due to apify schema changes#889
ramiAbdou merged 3 commits into
mainfrom
rami/apify

Conversation

@ramiAbdou
Copy link
Copy Markdown
Member

@ramiAbdou ramiAbdou commented Jan 12, 2026

Description ✏️

This PR fixes an issue with the LinkedIn sync that is due to schema changes that happened with the Apify actor. Not sure why they changed it or if we can pin it somehow but this is a quick fix.

Type of Change 🐞

  • Feature - A non-breaking change which adds functionality.
  • Fix - A non-breaking change which fixes an issue.
  • Refactor - A change that neither fixes a bug nor adds a feature.
  • Documentation - A change only to in-code or markdown documentation.
  • Tests - A change that adds missing unit/integration tests.
  • Chore - A change that is likely none of the above.

Checklist ✅

  • I have done a self-review of my code.
  • I have manually tested my code (if applicable).
  • I have added/updated any relevant documentation (if applicable).

Note

Aligns LinkedIn sync with Apify’s updated response shape and fixes company scraping input.

  • Updates LinkedInProfile/LinkedInFailure schemas: remove element nesting; add top-level education/experience/photo/headline/location; Failure now includes error array
  • Adjusts sync logic to treat results without error as success and to read fields from the new top-level paths (education, experience, location, headline, photo)
  • Replaces checks like !profile.element with profile.error and updates all downstream uses (processProfile, checkMember, etc.)
  • Changes company scraping to pass full LinkedIn company URL in runActor body (companies: ["https://www.linkedin.com/company/${id}"])

Written by Cursor Bugbot for commit 9694441. This will update automatically on new commits. Configure here.

@ramiAbdou ramiAbdou self-assigned this Jan 12, 2026
@ramiAbdou ramiAbdou merged commit 8782d47 into main Jan 12, 2026
3 checks passed
@ramiAbdou ramiAbdou deleted the rami/apify branch January 12, 2026 16:45
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

companies: [
`https://www.linkedin.com/company/${companyNameOrLinkedInId}`,
],
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Company lookup broken when using company names

High Severity

The saveCompanyIfNecessary function accepts both company names and LinkedIn IDs (as indicated by the parameter name and database query), but the new URL construction assumes the input is always a LinkedIn ID or slug. When called from offers.ts with human-readable company names like "Google" or "The Walt Disney Company", the constructed URL https://www.linkedin.com/company/${companyNameOrLinkedInId} will likely fail since company display names rarely match their LinkedIn universal names exactly. Additionally, company names with spaces aren't URL-encoded, creating malformed URLs. This breaks the offer creation flow for any company not already in the database.

Fix in Cursor Fix in Web

await Promise.all(
newResults.map(async (result) => {
if (result.element) {
if (!result.error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache key unchanged despite schema change causing parse failures

High Severity

The cache key version remains v2 despite the schema change from element-wrapped structure to flat structure. Cached data from before this change has the old format (e.g., { element: { education: [...] } }), but LinkedInResult.parse(value) at line 652 now expects the new flat format. This causes Zod parse errors when processing members with old cached profiles. Since there's no try-catch around the parse and it's inside Promise.all, the entire batch fails. The cache key version needs to be incremented (e.g., to v3) to invalidate stale cached data.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

1 participant