@@ -174,17 +174,24 @@ export class IntegrationManager implements IIntegrationManager {
174174 const blocksWithIntegrations : BlockWithIntegration [ ] = [ ] ;
175175
176176 for ( const cell of notebook . getCells ( ) ) {
177- const deepnoteMetadata = cell . metadata ?. deepnoteMetadata ;
178- logger . trace ( `IntegrationManager: Cell ${ cell . index } metadata:` , deepnoteMetadata ) ;
179-
180- if ( deepnoteMetadata ?. sql_integration_id ) {
181- blocksWithIntegrations . push ( {
182- id : `cell-${ cell . index } ` ,
183- sql_integration_id : deepnoteMetadata . sql_integration_id
184- } ) ;
177+ const metadata = cell . metadata ;
178+ logger . trace ( `IntegrationManager: Cell ${ cell . index } metadata:` , metadata ) ;
179+
180+ // Check cell metadata for sql_integration_id
181+ if ( metadata && typeof metadata === 'object' ) {
182+ const integrationId = ( metadata as Record < string , unknown > ) . sql_integration_id ;
183+ if ( typeof integrationId === 'string' ) {
184+ logger . debug ( `IntegrationManager: Found integration ${ integrationId } in cell ${ cell . index } ` ) ;
185+ blocksWithIntegrations . push ( {
186+ id : `cell-${ cell . index } ` ,
187+ sql_integration_id : integrationId
188+ } ) ;
189+ }
185190 }
186191 }
187192
193+ logger . debug ( `IntegrationManager: Found ${ blocksWithIntegrations . length } cells with integrations` ) ;
194+
188195 // Use the shared utility to scan blocks and build the status map
189196 return scanBlocksForIntegrations ( blocksWithIntegrations , this . integrationStorage , 'IntegrationManager' ) ;
190197 }
0 commit comments