Tahul / nuxt-edgedb

💽 Nuxt 3 integration for EdgeDB
71 stars 7 forks source link

Cloud databases #30

Open maxdzin opened 5 months ago

maxdzin commented 5 months ago

Greetings!

Is it possible to make this module work with EdgeDB cloud? If so, can you explain how exactly?

Thank you!

Tahul commented 5 months ago

Hello there :)

It sure is, you can take advantage of env variables to do so.

From EdgeDB Cloud, you should be provided with a DSN to use, you can use that in development, or use a local instance in develpment and use that Cloud DSN in production.

maxdzin commented 4 months ago

Hi! Thank you for your response. I haven't had enough time yet to take a look at that, but will check it out soon. Thank you!

watzon commented 2 months ago

EdgeDB Cloud doesn't supply DSN information. Instead they give you a secret key and expect you to use the CLI. I've been trying to debug why this doesn't work properly in Vercel and from what I can tell the CLI isn't being installed in the environment in Vercel so even though I'm providing the EDGEDB_INSTANCE and EDGEDB_SECRET_KEY env vars it still doesn't work.

Searching the code, the installCli configuration option doesn't appear to actually do anything?

maxdzin commented 2 months ago

Yes, I tried yesterday to use the EdgeDB created in Vercel and connect the application using the provided credentials, but no success so far. Also, I haven't found any clear documentation on how to get this to work.

watzon commented 2 months ago

From what I can see from the code for this repo, it expects the edgedb cli to be available, and if it is it tries to make use of that. What I think it needs to do after that is check for the environment variables EDGEDB_INSTANCE and EDGEDB_SECRET_KEY and attempt to connect with the cloud that way, otherwise it should continue to fallback to the DSN.

The EdgeDB docs have Vercel working out of the box because the official EdgeDB JavaScript SDK looks for those env vars when it makes the connection. This just needs to do the same.