I’m trying to deploy a Remix application to Netlify’s Edge Functions, following the template in this repo. I’m using a read-only SQLite database as my data store, and I’d like to read from it inside the Edge Functions.
I’ve gotten this to work locally using netlify dev
, where my generated functions read the SQLite database from the filesystem. Setting my DATABASE_URL
environment variable in Netlify’s online configuration to the same value as local (or really any file path) causes the deployed functions to crash:
This edge function has crashed
An unhandled error in the function code triggered the following message:
The deployment failed while serving the request.
Connection details
Netlify internal ID: 01G20YT4RKK06H1GPN0DAVFFMG
Checking the Edge Functions tab on Netlify just has an endless spinner—the logs never load.
I think the problem is that my Edge Functions don’t have a way to access the database file. I’ve found other support threads (here and here) that seem to support this hypothesis, but they are for regular Netlify functions. They reference zip-it-and-ship-it
as a possible solution, but that appears to be for Node.js where Edge Functions use Deno. And those threads didn’t seem to reach a clear conclusion.
I found configuration in the docs for including files in a Function, but I couldn’t find any equivalent options for Edge Functions.
I know Edge Functions (and using them with Remix) are in beta, and that loading binary files in a regular Function is not well supported right now. Is there a way to load a SQLite database file in an Edge Function, without hosting it somewhere else and accessing it over the network? Are there plans to support such a setup as Edge Functions evolve? Is what I’m looking for supported in regular Functions using the above configuration?
Other info:
Netlify site id: 09fdb2c2-0def-404b-8201-ce5cb2237db8
netlify.toml
:
[build]
command = "remix build"
publish = "public"
[dev]
command = "remix watch"
port = 3000
[[headers]]
for = "/build/*"
[headers.values]
"Cache-Control" = "public, max-age=31536000, s-maxage=31536000"