Skip to content

Commit

Permalink
fix test and dont log secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 22, 2024
1 parent 67665f7 commit cdc9426
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
16 changes: 5 additions & 11 deletions packages/api/src/routes/nfts-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ export async function nftUpload(event, ctx) {
})
}

const w3upConfig = {
W3UP_URL: ctx.W3UP_URL,
W3_NFTSTORAGE_PRINCIPAL: ctx.W3_NFTSTORAGE_PRINCIPAL,
W3_NFTSTORAGE_PROOF: ctx.W3_NFTSTORAGE_PROOF,
W3_NFTSTORAGE_SPACE: ctx.W3_NFTSTORAGE_SPACE,
}
console.log('in nfts-upload handler w/ w3up', {
...w3upConfig,
w3up: ctx.w3up,
})
if (ctx.w3up) {
try {
await ctx.w3up.uploadCAR(carBlobForW3up)
Expand All @@ -129,10 +119,14 @@ export async function nftUpload(event, ctx) {
// explicitly log so we can debug w/ cause
console.warn('error with w3up.uploadCAR', {
error,
cause: error?.cause,
cause: /** @type any */ (error)?.cause,
})
throw error
}
} else {
console.warn(
'nftUpload route skipping w3up storage due to missing ctx.w3up'
)
}

return new JSONResponse({ ok: true, value: toNFTResponse(upload) })
Expand Down
7 changes: 4 additions & 3 deletions packages/api/test/nfts-upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ test.serial('should forward uploads to W3UP_URL', async (t) => {
)

const finalW3upUploadAddCount = mockW3upUploadAddCount
const uploadAddCountDelta = finalW3upUploadAddCount - initialW3upStoreAddCount
const uploadAddCountDelta =
finalW3upUploadAddCount - initialW3upUploadAddCount
t.is(
storeAddCountDelta,
uploadAddCountDelta,
1,
'this upload sent one valid store/add invocation to w3up'
'this upload sent one valid upload/add invocation to w3up'
)
})

Expand Down

0 comments on commit cdc9426

Please sign in to comment.