Skip to content

Commit

Permalink
fix: remove debugging console.logs and nodejs_compat flag (#2553)
Browse files Browse the repository at this point in the history
I added these all while debugging upload issues, should be able to
remove them now
  • Loading branch information
travis authored Apr 2, 2024
1 parent b4ff571 commit 6ceb299
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
14 changes: 0 additions & 14 deletions packages/api/src/routes/nfts-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export async function nftUpload(event, ctx) {
let car
/** @type {string} */

console.log('IS CAR?', isCar)
if (isCar) {
car = blob
uploadType = 'Car'
Expand All @@ -93,7 +92,6 @@ export async function nftUpload(event, ctx) {
uploadType = 'Blob'
structure = 'Complete'
}
console.log('NFT UPLOADING CAR')
upload = await uploadCar({
event,
ctx,
Expand All @@ -107,7 +105,6 @@ export async function nftUpload(event, ctx) {
meta: type === 'ucan' ? { ucan } : undefined,
})
}
console.log('UPLOADED IT, SENDING A RESPONSE!')
return new JSONResponse({ ok: true, value: toNFTResponse(upload) })
}

Expand Down Expand Up @@ -145,7 +142,6 @@ function w3upFeatureSwitchEnabled(context, event) {
* @param {UploadCarInput} params
*/
export async function uploadCar(params) {
console.log('UPLOAD CAR')
const stat = await carStat(params.car, {
structure: params.structure,
})
Expand All @@ -161,7 +157,6 @@ export async function uploadCarWithStat(
{ event, ctx, user, key, car, uploadType = 'Car', mimeType, files, meta },
stat
) {
console.log('UCWS')
const sourceCid = stat.rootCid.toString()
const contentCid = stat.rootCid.toV1().toString()

Expand All @@ -177,11 +172,8 @@ export async function uploadCarWithStat(
const backupUrls = []
// @ts-expect-error email is not expected in types
if (ctx.w3up && w3upFeatureSwitchEnabled(ctx, { user })) {
console.log('SWITCH ENABLED')
const { w3up } = ctx

console.log('UPLOADING CAR')

// we perform store/add and upload/add concurrently to save time.
await Promise.all([
w3up.capability.store.add(car),
Expand All @@ -191,13 +183,11 @@ export async function uploadCarWithStat(
w3up.capability.upload.add(stat.rootCid, [stat.cid]),
])

console.log('UPLOADED CAR')
// register as gateway links to record the CAR CID - we don't have another
// way to know the location right now.
backupUrls.push(new URL(`https://w3s.link/ipfs/${stat.cid}`))

if (stat.structure === 'Partial') {
console.log('PARTIAL')
checkDagStructureTask = async () => {
// @ts-expect-error - I'm not sure why this started failing TODO debug further
const info = await w3up.capability.upload.get(stat.rootCid)
Expand Down Expand Up @@ -242,7 +232,6 @@ export async function uploadCarWithStat(
}
}
}
console.log('UPLOADED')
const xName = event.request.headers.get('x-name')
let name = xName && decodeURIComponent(xName)
if (!name || typeof name !== 'string') {
Expand All @@ -258,7 +247,6 @@ export async function uploadCarWithStat(
status: structure === 'Complete' ? 'Pinned' : 'Pinning',
service: 'ElasticIpfs',
})
console.log('CREATING DB UPLOAD')
const upload = await ctx.db.createUpload({
mime_type: mimeType,
type: uploadType,
Expand All @@ -276,10 +264,8 @@ export async function uploadCarWithStat(

// no need to ask linkdex if it's Complete or Unknown
if (checkDagStructureTask) {
console.log('CHECK DAG STRUCTURE TASK IS TRU')
event.waitUntil(checkDagStructureTask())
}
console.log('RETURNING')
return upload
}

Expand Down
1 change: 0 additions & 1 deletion packages/api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ compatibility_flags = [
"streams_enable_constructors",
"transformstream_enable_standard_constructor",
"url_standard",
"nodejs_compat",
]
no_bundle = true
r2_buckets = [
Expand Down

0 comments on commit 6ceb299

Please sign in to comment.