Merge pull request #1704 from omnivore-app/fix/importer-logging

Improve logging on errors in the importer tool
This commit is contained in:
Jackson Harper
2023-01-25 14:23:50 +08:00
committed by GitHub
2 changed files with 6 additions and 11 deletions

View File

@ -166,7 +166,6 @@ const sendSavePageMutation = async (userId: string, input: unknown) => {
'Content-Type': 'application/json',
},
})
console.log('save page response: ', response)
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
return !!response.data.data.savePage
@ -256,7 +255,12 @@ export const importHandler = Sentry.GCPFunction.wrapHttpFunction(
const pubSubMessage = req.body.message.data as string
const obj = getStorageEvent(pubSubMessage)
if (obj) {
await handleEvent(obj)
try {
await handleEvent(obj)
} catch (err) {
console.log('error handling event', { err, obj })
throw err
}
}
} else {
console.log('no pubsub message')

View File

@ -29,15 +29,6 @@ export const createCloudTask = async (
const serviceAccountEmail = `${project}@appspot.gserviceaccount.com`
const parent = cloudTask.queuePath(project, location, queue)
console.log(`Task creation options: `, {
project,
location,
queue,
taskHandlerUrl,
serviceAccountEmail,
payload,
})
const convertedPayload = JSON.stringify(payload)
const body = Buffer.from(convertedPayload).toString('base64')
const task: protos.google.cloud.tasks.v2.ITask = {