diff --git a/packages/facade/src/index.ts b/packages/facade/src/index.ts index ee8f8549..ea0fe9bc 100644 --- a/packages/facade/src/index.ts +++ b/packages/facade/src/index.ts @@ -233,7 +233,11 @@ export class RestoreCommerceFacade imp if (url !== 'local') { return new RemoteGraphQLDataSource({ url, - // TODO willSendRequest + willSendRequest({ request, context }): Promise | void { + if (context && context['authorization']) { + request.http.headers.set('authorization', context['authorization']); + } + }, }); } else { const schema = this.apolloServices[name]?.schema; diff --git a/packages/scs-jobs/src/index.ts b/packages/scs-jobs/src/index.ts index 4a6f7dad..7e3c030b 100644 --- a/packages/scs-jobs/src/index.ts +++ b/packages/scs-jobs/src/index.ts @@ -145,11 +145,14 @@ export const runWorker = async ( const start = Date.now(); const result = await cb(job); logger.verbose(`job@${filteredJob.name}#${filteredJob.id} completed in ${Date.now() - start}ms`, filteredJob); - let marshalledResult; + let marshalledResult: any; if (result) marshalledResult = marshallProtobufAny(result); await jobEvents.emit('jobDone', { - id: job.id, type: job.name, schedule_type: job.data.schedule_type, result: marshalledResult + id: job.id, + type: job.name, + schedule_type: job.data.schedule_type, + result: marshalledResult }); return result; @@ -188,7 +191,7 @@ export type RunWorkerFunc = typeof runWorker; export type DefaultExportFunc = ( cfg: ServiceConfig, logger: Logger, - events: Event, + events: Events, runWorker: RunWorkerFunc, ) => Promise; export * from './types.js'; \ No newline at end of file