Skip to content

Commit 56e9e91

Browse files
committed
Validate integration type before DEEPNOTE_TO_INTEGRATION_TYPE lookup
Add validation in IntegrationManager to check that projectIntegration.type exists as a key in DEEPNOTE_TO_INTEGRATION_TYPE before performing the lookup. If the type is unknown, log a warning with context (integration ID, project ID, and the unexpected type value) and leave integrationType undefined so callers can handle missing mappings explicitly.
1 parent 8e78c67 commit 56e9e91

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/notebooks/deepnote/integrations/integrationManager.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,16 @@ export class IntegrationManager implements IIntegrationManager {
168168

169169
if (projectIntegration) {
170170
integrationName = projectIntegration.name;
171-
// Map the Deepnote integration type to our IntegrationType
172-
integrationType = DEEPNOTE_TO_INTEGRATION_TYPE[projectIntegration.type as RawIntegrationType];
171+
172+
// Validate that projectIntegration.type exists in the mapping before lookup
173+
if (projectIntegration.type in DEEPNOTE_TO_INTEGRATION_TYPE) {
174+
// Map the Deepnote integration type to our IntegrationType
175+
integrationType = DEEPNOTE_TO_INTEGRATION_TYPE[projectIntegration.type as RawIntegrationType];
176+
} else {
177+
logger.warn(
178+
`IntegrationManager: Unknown integration type '${projectIntegration.type}' for integration ID '${selectedIntegrationId}' in project '${projectId}'. Integration type will be undefined.`
179+
);
180+
}
173181
}
174182

175183
integrations.set(selectedIntegrationId, {

0 commit comments

Comments
 (0)