Skip to content

Chapter 6: The lib file to seed the db contains duplicate ID values #1005

Open
@Razr6

Description

@Razr6

in placeholder-data.ts 👍

{
id: '3958dc9e-712f-4377-85e9-fec4b6a6442a',
name: 'Delba de Oliveira',
email: 'delba@oliveira.com',
image_url: '/customers/delba-de-oliveira.png',
},
{
id: '3958dc9e-742f-4377-85e9-fec4b6a6442a',
name: 'Lee Robinson',
email: 'lee@robinson.com',
image_url: '/customers/lee-robinson.png',
},

because id must be unique, the db seeding fails, with the error (I am on Neon) of:

{
"error": {
"name": "PostgresError",
"severity_local": "ERROR",
"severity": "ERROR",
"code": "23505",
"detail": "Key (extname)=(uuid-ossp) already exists.",
"schema_name": "pg_catalog",
"table_name": "pg_extension",
"constraint_name": "pg_extension_name_index",
"file": "nbtinsert.c",
"line": "664",
"routine": "_bt_check_unique"
}
}

Activity

changed the title [-]The lib file to seed the db contains 2x customers with duplicate id[/-] [+]Chapter 6: The lib file to seed the db contains duplicate ID values[/+] on Feb 12, 2025
DavidCWHung

DavidCWHung commented on Feb 24, 2025

@DavidCWHung

id: '3958dc9e-712f-4377-85e9-fec4b6a6442a', and id: '3958dc9e-742f-4377-85e9-fec4b6a6442a', seems different tho?

leerob

leerob commented on Feb 25, 2025

@leerob
Member

This might be because you're already ran the seeding process and the data is in the DB. Could you check?

Razr6

Razr6 commented on Feb 25, 2025

@Razr6
Author

Sorry, I'm a newb and am just struggling my way through the tutorial, for the fourth time. I can't now tell if I had seeded it once or twice, when this happened.

When I first got the error, I looked about, looked in the db files and as far as I can I remember, the other tables had all seeded ok but the customer table was simply not there. And then I thought I had traced the problem back to the data in the placeholder-data.ts file. But as DavidCWHung points out the IDs are actually different - by just 1x character, buried in the middle of a 36 chr string (?).

Anyway. So I guess I was wrong. Looks like I am probably wasting your time here.

w0244079

w0244079 commented on Feb 26, 2025

@w0244079

@leerob I experienced the same issue today when doing the tutorial...I've sent along a PR (#1013) for review which when applied fixed the problem for me....hope it helps.

chrissygonzalez

chrissygonzalez commented on Mar 3, 2025

@chrissygonzalez

I also ran into problems seeding (somehow missing the invoice in the chapter 6 query, and fewer than expected customers). @w0244079 Your fix worked for me, thank you. I can move on to chapter 7 now 🥇

kRadius

kRadius commented on Jun 16, 2025

@kRadius

change placeholder-data 'id' to other name.
for example:

const users = [
  {
    user_id: '410544b2-4001-4271-9855-fec4b6a6442a',
    name: 'User',
    email: 'user@nextmail.com',
    password: '123456',
  },
];

const customers = [
  {
    user_id: 'd6e15727-9fe1-4961-8c5b-ea44a9bd81aa',
    name: 'Evil Rabbit',
    email: 'evil@rabbit.com',
    image_url: '/customers/evil-rabbit.png',
  },

then fix 'seed/route.ts' error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @w0244079@chrissygonzalez@kRadius@leerob@DavidCWHung

      Issue actions

        Chapter 6: The lib file to seed the db contains duplicate ID values · Issue #1005 · vercel/next-learn