-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Note that the effect code I'm referring to here is actually written in cljs not typescript, thought that maybe that has something to do with the error.
For some reason when using S.nullable(S.object(...)) as definition for effect output I get this error:
[16:32:22.204] ERROR (42536): Failed to insert items into table "envio_effect_getPositionState"
err: {
"type": "TypeError",
"message": "Cannot read properties of null (reading 'token0_address')",
"stack":
TypeError: Cannot read properties of null (reading 'token0_address')
at Object.eval [as convertOrThrow] (eval at compile (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/rescript-schema@9.3.0_rescript@11.1.3/node_modules/rescript-schema/src/S_Core.res.js:805:10), :3:172)
at setOrThrow (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/envio@2.31.1/node_modules/envio/src/PgStorage.res.js:271:48)
at setOrThrow$1 (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/envio@2.31.1/node_modules/envio/src/PgStorage.res.js:570:12)
at Object.setEffectCacheOrThrow (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/envio@2.31.1/node_modules/envio/src/PgStorage.res.js:583:18)
at Object.setEffectCacheOrThrow (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/envio@2.31.1/node_modules/envio/src/Persistence.res.js:146:17)
at /Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/src/IO.res.js:200:59
at Object.keepMapU (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/node_modules/.pnpm/rescript@11.1.3/node_modules/rescript/lib/js/belt_Array.js:400:15)
at Object.executeBatch (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/src/IO.res.js:185:34)
at executeBatch (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/src/EventProcessing.res.js:301:24)
at Object.processEventBatch (/Users/kenauvith/Downloads/c139ca7-9fc8489 2/generated/src/EventProcessing.res.js:333:18)
"promesa$protocols$IPromiseFactory$": {}
}
However, when it's updated to S.object(S.schema(...)) it seems to fix this error but then throws another error later:
err: {
"type": "TypeError",
"message": "Do not know how to serialize a BigInt",
"stack":
TypeError: Do not know how to serialize a BigInt
at JSON.stringify ()
This itself I haven't actually reproduced as I'm more interested in the error related to S.nullable(S.object(...)). I'm not sure exactly how to solve it. I thought maybe the issue has to do with it being written in cljs somehow. To reproduce it you can download c139ca7-9fc8489 from revert-indexer-2 and then call the getPositionState at the top of the transfer handler so it runs early. The effect is in line 227 of src/cljs/univ3/effects.cljs