Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported configuration for Nuxt - Vercel Edge #55

Open
ZainW opened this issue May 6, 2023 · 3 comments
Open

Unsupported configuration for Nuxt - Vercel Edge #55

ZainW opened this issue May 6, 2023 · 3 comments
Labels
bug Something isn't working PRs Accepted Feel free to pick this up and make a PR

Comments

@ZainW
Copy link

ZainW commented May 6, 2023

was converting my env usage from the built in nuxt one (using useRuntimeConfig) to the t3-env

ran into a a situation that is not supported

// serve/utils/kysely.ts
import { Kysely } from 'kysely'
import { PlanetScaleDialect } from 'kysely-planetscale'

import type { DB } from '~/lib/db'
import { env } from '~/env'

export const db = new Kysely<DB>({
  dialect: new PlanetScaleDialect({
    url: env.DATABASE_URL,
  }),
})

this is something that does work when using Nuxt's default runtime as such

import { Kysely } from 'kysely'
import { PlanetScaleDialect } from 'kysely-planetscale'

import type { DB } from '~/lib/db'

const config = useRuntimeConfig()
export const db = new Kysely<DB>({
  dialect: new PlanetScaleDialect({
    url: config.DATABASE_URL,
  }),
})

getting an error that crashes the edge function saying DATABASE_URL is required

this only happens when deploying to vercel-edge as opposed to just the vercel preset.

do environment variables load differently when bundled for edge? is there a way to make it use nuxt's own runtimeConfig https://nuxt.com/docs/api/composables/use-runtime-config#environment-variables

@juliusmarminge
Copy link
Member

do environment variables load differently when bundled for edge?

ah they might be treeshaking them from process.env on edge - similar to Next...

cc @nexxeln can you check plz :)

@nexxeln
Copy link
Member

nexxeln commented May 7, 2023

yeah i can reproduce this

@juliusmarminge
Copy link
Member

Do we need to do manual destruction here too?

@juliusmarminge juliusmarminge added bug Something isn't working PRs Accepted Feel free to pick this up and make a PR labels Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PRs Accepted Feel free to pick this up and make a PR
Projects
None yet
Development

No branches or pull requests

3 participants