-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[BUG] 403 error when trying to create a simple text post in LinkedIn #17829
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis change updates several LinkedIn integration components. Most files only have version number increments. However, the post creation actions for users and organizations are updated to explicitly set the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant LinkedInApp
participant LinkedInAPI
User->>Action: Trigger create-text-post-user
Action->>LinkedInApp: getCurrentMemberProfile()
LinkedInApp-->>Action: Return user profile (id)
Action->>LinkedInApp: createPost({ author: urn:li:person:{id}, lifecycleState, distribution, ... })
LinkedInApp->>LinkedInAPI: POST /posts with payload
LinkedInAPI-->>LinkedInApp: Response
LinkedInApp-->>Action: Response
Action-->>User: Success or error
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (21)
✅ Files skipped from review due to trivial changes (9)
🚧 Files skipped from review as they are similar to previous changes (12)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
832b67d
to
fddafd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs (1)
31-48
: Payload now incomplete afterlinkedin.app.createPost
refactor
linkedin.app.mjs
no longer augments the payload, so this action must now provide the full Posts API body.
Currently missing mandatory fields:
lifecycleState: "PUBLISHED"
distribution: { feedDistribution: "MAIN_FEED" }
author
should be a URN (e.g.urn:li:organization:${id}
), not the raw numeric ID.Without these, LinkedIn returns HTTP 403/422.
- const data = { - author: this.organizationId, - commentary: utils.escapeText(this.text), - visibility: "PUBLIC", - }; + const data = { + author: `urn:li:organization:${this.organizationId}`, + lifecycleState: "PUBLISHED", + distribution: { + feedDistribution: "MAIN_FEED", + }, + specificContent: { + "com.linkedin.ugc.ShareContent": { + shareCommentary: { + text: utils.escapeText(this.text), + }, + shareMediaCategory: this.article ? "ARTICLE" : "NONE", + ...(this.article && { + media: [ + { + status: "READY", + originalUrl: this.article, + }, + ], + }), + }, + }, + visibility: "PUBLIC", + };Please adjust and retest to ensure the 403 is resolved for organizations as well.
🧹 Nitpick comments (3)
components/linkedin/actions/create-comment/create-comment.mjs (1)
7-7
: Version bump looks good – remember to sync docs/changelog.No functional diff besides the metadata increment to
0.1.8
. Ensure the package‐level changelog and any public docs reflect this new action version so users can track the change.components/linkedin/package.json (1)
3-4
: Package version updated but changelog entry missingBumping to
1.2.1
is fine, but please ensure the package-level CHANGELOG (if maintained) is updated so downstream consumers understand what changed in this release.components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs (1)
18-20
: Typo in description
Orgainization
→Organization
- description: "You can get the Orgainization Vanity Name from the company LinkedIN URL, for example, if the company LinkedIn URL is `https://www.linkedin.com/company/confluent`, then the Organization Vanity Name is `confluent`.", + description: "You can get the Organization Vanity Name from the company LinkedIn URL. For example, if the URL is `https://www.linkedin.com/company/confluent`, the Organization Vanity Name is `confluent`.",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (21)
components/linkedin/actions/create-comment/create-comment.mjs
(1 hunks)components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs
(2 hunks)components/linkedin/actions/create-image-post-user/create-image-post-user.mjs
(2 hunks)components/linkedin/actions/create-like-on-share/create-like-on-share.mjs
(1 hunks)components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs
(1 hunks)components/linkedin/actions/create-text-post-user/create-text-post-user.mjs
(2 hunks)components/linkedin/actions/delete-post/delete-post.mjs
(1 hunks)components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs
(1 hunks)components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs
(1 hunks)components/linkedin/actions/get-member-profile/get-member-profile.mjs
(1 hunks)components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs
(1 hunks)components/linkedin/actions/get-org-member-access/get-org-member-access.mjs
(1 hunks)components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs
(1 hunks)components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs
(1 hunks)components/linkedin/actions/get-profile-picture-fields/get-profile-picture-fields.mjs
(1 hunks)components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs
(1 hunks)components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs
(1 hunks)components/linkedin/actions/search-organization/search-organization.mjs
(1 hunks)components/linkedin/linkedin.app.mjs
(1 hunks)components/linkedin/package.json
(1 hunks)components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs
(1 hunks)
🧰 Additional context used
🧠 Learnings (10)
components/linkedin/actions/get-member-profile/get-member-profile.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-text-post-organization/create-text-post-organization.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-comment/create-comment.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/sources/new-organization-post-created/new-organization-post-created.mjs (1)
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/search-organization/search-organization.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (3)
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/linkedin/actions/create-image-post-user/create-image-post-user.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
🧬 Code Graph Analysis (1)
components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (1)
components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs (1)
response
(13-15)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (20)
components/linkedin/actions/get-organization-access-control/get-organization-access-control.mjs (1)
7-7
: Version bump LGTM
Incrementingversion
to0.2.2
without logic changes is fine. Ensure the CHANGELOG reflects this.components/linkedin/actions/fetch-ad-account/fetch-ad-account.mjs (1)
7-7
: Minor metadata update acknowledged
version: "0.1.8"
is consistent with other LinkedIn actions in this PR. No further action required.components/linkedin/actions/get-profile-picture-fields/get-profile-picture-fields.mjs (1)
8-8
: Version increment noted
0.0.3
correctly bumps the action without altering behavior. Confirm docs are updated accordingly.components/linkedin/actions/delete-post/delete-post.mjs (1)
7-7
: Metadata bump accepted
version
update to0.0.8
is straightforward and harmonious with the release series.components/linkedin/actions/get-member-profile/get-member-profile.mjs (1)
7-7
: Aligned version bump
Raising to0.1.8
keeps versioning uniform; no code issues identified.components/linkedin/actions/retrieve-comments-on-comments/retrieve-comments-on-comments.mjs (1)
7-7
: Consistent version update acknowledged.The minor bump to
0.1.8
keeps this action aligned with the rest of the LinkedIn package. Nothing else to flag.components/linkedin/actions/search-organization/search-organization.mjs (1)
7-7
: Minor version increment accepted.
0.1.8
matches the coordinated release. Good to go.components/linkedin/actions/retrieve-comments-shares/retrieve-comments-shares.mjs (1)
7-7
: Version bump verified.No behavioral changes accompany this update; metadata only. 👍
components/linkedin/actions/get-multiple-member-profiles/get-multiple-member-profiles.mjs (1)
7-7
: Version aligns with package update.The shift to
0.1.8
is consistent. No further action required.components/linkedin/actions/create-like-on-share/create-like-on-share.mjs (1)
7-8
: Version bump looks goodThe version alignment keeps this action in sync with the rest of the LinkedIn package. No functional changes detected.
components/linkedin/actions/get-org-member-access/get-org-member-access.mjs (1)
7-8
: LGTM on straight version bumpNothing else changed – safe update.
components/linkedin/actions/get-current-member-profile/get-current-member-profile.mjs (1)
7-7
: LGTM! Version increment supports the overall fix.This version increment aligns with the broader LinkedIn action updates. This action plays a crucial role in resolving the 403 error by providing the current member profile data that other post creation actions now use to properly set the author URN.
components/linkedin/actions/get-organization-administrators/get-organization-administrators.mjs (1)
7-7
: LGTM! Coordinated version increment.This version increment is part of the coordinated maintenance update across LinkedIn action components.
components/linkedin/actions/create-image-post-user/create-image-post-user.mjs (2)
10-10
: LGTM! Version increment reflects important functional changes.
88-98
: Excellent fix for the 403 error issue!These changes directly address the LinkedIn 403 authorization error by:
- Dynamic profile fetching: Using
getCurrentMemberProfile()
ensures the correct LinkedIn member ID is obtained at runtime- Proper URN formatting: Setting author as
urn:li:person:${id}
instead of using the OAuth UID directly- Required metadata: Adding
lifecycleState: "PUBLISHED"
anddistribution.feedDistribution: "MAIN_FEED"
provides the complete post structure LinkedIn expectsThis approach is more robust than relying on the OAuth UID and should resolve the authorization issues users were experiencing.
components/linkedin/actions/create-image-post-organization/create-image-post-organization.mjs (2)
10-10
: LGTM! Version increment reflects important functional changes.
90-94
: Excellent consistency with user post action!These changes mirror the improvements made in the user post action:
- Proper URN formatting: Author set as
urn:li:organization:${this.organizationId}
- Required metadata: Adding
lifecycleState: "PUBLISHED"
anddistribution.feedDistribution: "MAIN_FEED"
This consistent approach across user and organization post actions ensures the 403 error fix works for both contexts.
components/linkedin/actions/create-text-post-user/create-text-post-user.mjs (2)
8-8
: LGTM! Version increment reflects the critical 403 error fix.
67-69
: Good defensive programming with fallback return value.The fallback
{ success: true }
ensures the action doesn't return undefined if the LinkedIn API response is falsy, which improves reliability.components/linkedin/linkedin.app.mjs (1)
160-166
: createPost refactor is safe—no action neededAll callers still
await
the promise returned bycreatePost
, so dropping theasync
keyword does not change its behavior. Each LinkedIn action component now builds the full payload—includingauthor
,lifecycleState: "PUBLISHED"
, anddistribution.feedDistribution: "MAIN_FEED"
—before invokingcreatePost
. No callers rely on in-method payload construction, and all necessary fields are present in:
- components/linkedin/actions/create-text-post-organization
- components/linkedin/actions/create-text-post-user
- components/linkedin/actions/create-image-post-organization
- components/linkedin/actions/create-image-post-user
components/linkedin/actions/create-text-post-user/create-text-post-user.mjs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
fddafd1
to
c2db2e7
Compare
WHY
Resolves #17723
Summary by CodeRabbit