edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Scoping issue on upsert

Open colinhacks opened this issue 3 years ago • 0 comments

Context: https://discord.com/channels/841451783728529451/849374705210490900/972227851040485460

await e
      .insert(e.PricingEvent, {
        asset: selectById(e.Asset, asset.id),
        created: new Date(),
        ...fieldsToSet,
      })
      .unlessConflict((dbPricingEvent) => ({
        on: e.tuple([
          dbPricingEvent.fundingRound,
          dbPricingEvent.valuationType,
        ]),
        else: e.update(e.PricingEvent, () => ({
          set: {
            ...fieldsToSet,
          },
        })),
      }))
      .run(edgeClient)

Throws

InvalidReferenceError: object type or alias 'default::__withVar_3' does not exist

colinhacks avatar May 06 '22 23:05 colinhacks