Skip to content

[Bug]: Breaking Change: cities.json Removed โ€“ prisma/seed.ts Now Fails with 404ย #1346

@SourabhBhanwala

Description

@SourabhBhanwala

Issue Type

Other

Location (if applicable)

prisma/seed.ts

What's wrong?

Reproduction

Using the current implementation in prisma/seed.ts:

const cities = await fetchData('cities');

This resolves internally to the following endpoint:

https://raw.githubusercontent.com/dr5hn/countries-states-cities-database/master/json/cities.json

The request now returns:

404: Not Found

Root Cause

The repository no longer contains the file:

json/cities.json

Instead, only the compressed version is available:

json/cities.json.gz

Since the existing seeder logic expects an uncompressed .json file and does not handle gzip decompression, the request fails and results in a 404 error.

What should it be?

Update prisma/seed.ts

Modify the seeder to:

Fetch .json.gz

Decompress using zlib

Parse JSON

Example fix:

import { gunzipSync } from 'zlib';

async function fetchGzipJson(endpoint: string) {
const response = await fetch(${API_BASE}${endpoint}.json.gz);
const buffer = Buffer.from(await response.arrayBuffer());
const decompressed = gunzipSync(buffer);
return JSON.parse(decompressed.toString('utf-8'));
}

Then replace:

await fetchData('cities')

with:

await fetchGzipJson('cities')

seed.txt

Source (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions