#Buffer is not defined

5 messages · Page 1 of 1 (latest)

clear grail
#

In a new Nuxt3 app, I want to use Drizzle + Postgres and I have the following error in the browser:

Buffer is not defined at http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/postgres.js?v=7848555b:593:14

No errors in the console, and I can see the data retrieved from the database:

<script setup lang="ts">
import { users } from '~/server/db/schemas/users';
import { db } from '~/server/drizzle';

const allUsers = await db.select().from(users)
console.log({ allUsers })
</script>

<template>
  <h1 class="text-3xl font-bold underline">
    Users length: {{ allUsers.length }}
  </h1>
</template>
#

The page is flashing a white page with Users length: 1 before turning into a 500 Internal Server Error screen.

supple yacht
clear grail
#

Oh I see, I must create an api routes and then useFetch?