EdgeDB errors when using Rescript v12 on Deno with experimental web apis

I’m working on a project, a site that lets my friends vote on movies to watch on my plex server, and I am getting some odd errors. I’m not 100% sure which combo is causing them, but I wanted to raise it here in case something is compatible with something else. Stack:

  • Deno and Fresh, no issues from there so far. I do have to make sure I use Deno install so rescript deps are in node_modules
  • Rescript v12 via the @next tag
  • @rescript/webapi, latest version
  • rescript-edgedb, latest version

Something fidgety is going on, and I’m not sure where it’s coming from. Here’s an example error:

module InsertMovie = %edgeql(`
    # @name insertMovie
    insert Movie {
        title := <str>$title
    }
`)
You referred to the module db__edgeql, but we've found one called Db__edgeql instead.
Is the name's casing right?ReScript

The output from running deno run build:edgedb -- --watch looks fine.

// @sourceHash 90ae927fdc440d4fbef6d3721c860e99

module InsertMovie = {
  let queryText = `# @name insertMovie
      insert Movie {
          title := <str>$title
      }`
  
  @live  
  type args = {
    title: string,
  }
  
  type response = {
    id: string,
  }
  
  @live
  let query = (client: EdgeDB.Client.t, args: args): promise<result<response, EdgeDB.Error.errorFromOperation>> => {
    client->EdgeDB.QueryHelpers.singleRequired(queryText, ~args)
  }
  
  @live
  let transaction = (transaction: EdgeDB.Transaction.t, args: args): promise<result<response, EdgeDB.Error.errorFromOperation>> => {
    transaction->EdgeDB.TransactionHelpers.singleRequired(queryText, ~args)
  }
}

What’s the file called where module InsertMovie = %edgeql( lives?

db.res. I’ve tried different names and the same error appears.
If the file is named data.res I get the error The module or file data__edgeql can't be found..

I am not importing or using the file anywhere at this point.

Ok, so if I change the name of the file to be uppercase, the error goes away.
So Db.res or Data.res work, but db.res and data.res have this error.

So it’s a problem in the edgedb rescript integration.

Might be related to this issue with rescript embed lang

I tried using ReScript v11 and the error still shows up. I can work with having to keep the file names uppercase for now.

Yes, do that please, and it’ll hopefully be an easy fix.