Faith: the gist is I wanted to send a response (just to test) when everything completed, but it no longer did subscription 'complete' callback after I added graphql mutations/queries. the queries/mutations work and reflect in the DB. do i be missing somethin like am I using the apollo functions wrong?
const process$ = of(configuration).pipe(
tap((config) => (configuration = config)),
concatMap((configuration) =>
from(configuration.operations).pipe(
concatMap((operation) =>
mapProcessingOperation(operation, configuration),
),
),
),
toArray(),
mergeMapTo(getAllOutputFiles(processID)),
mergeMap((filePaths) => from(filePaths)),
mergeMap((filePath) => uploadToS3(s3, filePath, processID, userID)),
toArray(),
mergeMap((filePaths) => akpService$.pipe(
mergeMap((service) => {
const updateStatusVars = {
process_id: processID,
changes: {
status: 'success',
s3_url: filePaths[0],
},
};
return performUpdateProcess(service, updateProcessMutation, updateStatusVars);
})),
),
);I think maybe one of your outer observables may not have completed yet? Not sure.
Analyzing the code...
of(configuration)should complete, naturally, since it's a single value.from(configuration.operations)should also complete, as it is bounded by the config yaml definition.toArray()transforms it into a single emission, which we know will complete because of the first two source observables are bounded/will complete.- ❓ does the observable constructor definition for
getAllOutputFileshave asubscriber.complete()call? ✅ Yes, it does. from(filePaths)should complete because it comes from an array.- ❓ does the observable constructor definition for
uploadToS3have asubscriber.complete()call? ✅ Yes, it does. - Assuming it does have a complete call, then the succeeding
toArray()will be able to execute (since the whole list of emissions will be ready because of the completes). - ❓ Does the code run at this point, in the
mergeMap((service) => { }code area? DoesperformUpdateProcessrun? - ❓ does the observable constructor definition for
performUpdateProcesshave asubscribe.complete()call? ✅ Yes, it does.
Faith: I checked the performApolloMutation function reference and it seems like it passes thru subscriber.complete() right after subscriber.next() naman?
What does this mean? what does it seems like it passes thru mean?
- ❓ Have you begun to use VS Code's debugger?
- Try to see as well ifrxjs-spy might help you debug.