Merge pull request #1610 from omnivore-app/fix/reduce-logging
Remove some places we are logging too much data causing sentry failures
This commit is contained in:
@ -12,7 +12,6 @@ export const createPubSubClient = (): PubsubClient => {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
console.log(`Publishing ${topicName}`, msg)
|
||||
return client
|
||||
.topic(topicName)
|
||||
.publishMessage({ data: msg })
|
||||
@ -126,7 +125,6 @@ const expired = (body: PubSubRequestBody): boolean => {
|
||||
export const readPushSubscription = (
|
||||
req: express.Request
|
||||
): { message: string | undefined; expired: boolean } => {
|
||||
console.log('request query', req.body)
|
||||
if (req.query.token !== process.env.PUBSUB_VERIFICATION_TOKEN) {
|
||||
console.log('query does not include valid pubsub token')
|
||||
return { message: undefined, expired: false }
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import express from 'express'
|
||||
import { readPushSubscription } from '../../datalayer/pubsub'
|
||||
import { updateConfirmationCode } from '../../services/newsletters'
|
||||
import { saveNewsletterEmail } from '../../services/save_newsletter_email'
|
||||
import {
|
||||
NewsletterMessage,
|
||||
saveNewsletterEmail,
|
||||
} from '../../services/save_newsletter_email'
|
||||
|
||||
interface SetConfirmationCodeMessage {
|
||||
emailAddress: string
|
||||
@ -81,8 +84,7 @@ export function newsletterServiceRouter() {
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const data = JSON.parse(message)
|
||||
|
||||
const data = JSON.parse(message) as NewsletterMessage
|
||||
if (
|
||||
!('email' in data) ||
|
||||
!('content' in data) ||
|
||||
@ -96,7 +98,12 @@ export function newsletterServiceRouter() {
|
||||
|
||||
const result = await saveNewsletterEmail(data)
|
||||
if (!result) {
|
||||
console.log('Error creating newsletter link from data', data)
|
||||
console.log(
|
||||
'Error creating newsletter link from data',
|
||||
data.email,
|
||||
data.title,
|
||||
data.author
|
||||
)
|
||||
res.status(500).send('Error creating newsletter link')
|
||||
return
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ export function uploadServiceRouter() {
|
||||
const router = express.Router()
|
||||
|
||||
router.post('/:folder', async (req, res) => {
|
||||
logger.info('upload data to folder', req.params.folder)
|
||||
const { message: msgStr, expired } = readPushSubscription(req)
|
||||
|
||||
if (!msgStr) {
|
||||
@ -38,7 +37,7 @@ export function uploadServiceRouter() {
|
||||
data.userId
|
||||
}/${DateTime.now().toFormat('yyyy-LL-dd')}/${uuidv4()}.json`
|
||||
|
||||
logger.info('uploading data to', filePath)
|
||||
logger.info('uploading data to', { filePath })
|
||||
await uploadToBucket(
|
||||
filePath,
|
||||
Buffer.from(msgStr, 'utf8'),
|
||||
|
||||
@ -14,7 +14,7 @@ import { fetchFavicon } from '../utils/parser'
|
||||
import { updatePage } from '../elastic/pages'
|
||||
import { isBase64Image } from '../utils/helpers'
|
||||
|
||||
interface NewsletterMessage {
|
||||
export interface NewsletterMessage {
|
||||
email: string
|
||||
content: string
|
||||
url: string
|
||||
|
||||
@ -49,15 +49,6 @@ const createHttpTaskWithToken = async ({
|
||||
priority === 'low' && (queue = `${queue}-low`)
|
||||
|
||||
const parent = client.queuePath(project, location, queue)
|
||||
console.log(`Task creation options: `, {
|
||||
project,
|
||||
location,
|
||||
queue,
|
||||
taskHandlerUrl,
|
||||
serviceAccountEmail,
|
||||
payload,
|
||||
})
|
||||
|
||||
// Convert message to buffer.
|
||||
let convertedPayload: string | ArrayBuffer
|
||||
try {
|
||||
@ -118,14 +109,6 @@ export const createAppEngineTask = async ({
|
||||
}
|
||||
|
||||
const parent = client.queuePath(project, location, queue)
|
||||
console.log(`App Engine task creation options: `, {
|
||||
project,
|
||||
location,
|
||||
queue,
|
||||
taskHandlerUrl,
|
||||
payload,
|
||||
})
|
||||
|
||||
const task: protos.google.cloud.tasks.v2.ITask = {
|
||||
appEngineHttpRequest: {
|
||||
httpMethod: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user