-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(vercel): Add API-driven pipeline backend for Vercel integration setup #113094
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| from sentry import options | ||
| from sentry.constants import ObjectStatus | ||
| from sentry.identity.pipeline import IdentityPipeline | ||
| from sentry.identity.vercel.provider import VercelIdentityProvider | ||
| from sentry.integrations.base import ( | ||
| FeatureDescription, | ||
| IntegrationData, | ||
|
|
@@ -24,7 +25,7 @@ | |
| from sentry.integrations.pipeline import IntegrationPipeline | ||
| from sentry.integrations.services.integration import integration_service | ||
| from sentry.organizations.services.organization.model import RpcOrganization | ||
| from sentry.pipeline.views.base import PipelineView | ||
| from sentry.pipeline.views.base import ApiPipelineSteps, PipelineView | ||
| from sentry.pipeline.views.nested import NestedPipelineView | ||
| from sentry.projects.services.project.model import RpcProject | ||
| from sentry.projects.services.project_key import project_key_service | ||
|
|
@@ -435,8 +436,22 @@ | |
| def get_pipeline_views(self) -> Sequence[PipelineView[IntegrationPipeline]]: | ||
| return [self._identity_pipeline_view()] | ||
|
|
||
| def get_pipeline_api_steps(self) -> ApiPipelineSteps[IntegrationPipeline]: | ||
| provider = VercelIdentityProvider( | ||
| redirect_url=absolute_uri(self.oauth_redirect_url), | ||
| ) | ||
| return [ | ||
| provider.make_oauth_api_step(bind_key="oauth_data"), | ||
| ] | ||
|
Check failure on line 445 in src/sentry/integrations/vercel/integration.py
|
||
|
|
||
| def build_integration(self, state: Mapping[str, Any]) -> IntegrationData: | ||
| data = state["identity"]["data"] | ||
| # TODO: legacy views write token data to state["identity"]["data"] via | ||
| # NestedPipelineView. API steps write directly to state["oauth_data"]. | ||
| # Remove the legacy path once the old views are retired. | ||
| if "oauth_data" in state: | ||
| data = state["oauth_data"] | ||
| else: | ||
| data = state["identity"]["data"] | ||
| access_token = data["access_token"] | ||
| team_id = data.get("team_id") | ||
| client = VercelClient(access_token, team_id) | ||
|
Comment on lines
+451
to
457
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: In the API pipeline path, Suggested FixIn Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
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.
Missing
user_idfallback causesKeyErrorin API flowMedium Severity
In the API pipeline flow,
state["user_id"]on line 478 will raise aKeyError. The legacy flow binds"user_id"to state data viapipeline.bind_state("user_id", request.user.id)inIntegrationExtensionConfigurationView.init_pipeline(), but the API flow never does this — only"oauth_data"is bound by theOAuth2ApiStep. The PR description says the code "falls back tostate["uid"]foruser_idin the API flow," but this fallback was not actually implemented.Reviewed by Cursor Bugbot for commit 070a285. Configure here.