Error Deploy
teddytun
PROOP

8 days ago

We got errors for the deployment in the railway. Could you please try to help to resolve it?

Attachments

$10 Bounty

2 Replies

Railway
BOT

8 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


brody
EMPLOYEE

8 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 8 days ago


bytekeim
PRO

8 days ago

hyy,

ur railway build is dying on the next.js build step. theres 2 main issues killing it (everything else is just warnings that dont matter)

1. drizzle tables arent exported (this is the big one)

typescript is freaking out cuz it cant find any of ur tables:

Attempted import error: 'ownerContracts' is not exported from '@/db/schema'
Attempted import error: 'contractDevices' is not exported from '@/db/schema'
Attempted import error: 'devices' is not exported from '@/db/schema'
... like hundreds of these

ur api routes are trying to import these but theyre not exported lol

quick fix: go to ur schema file (probably src/db/schema.ts or app/db/schema.ts) and just add export before every table:

// add export to everything
export const owners = pgTable('owners', { ... });
export const ownerContracts = pgTable('owner_contracts', { ... });
export const contractDevices = pgTable('contract_devices', { ... });
export const devices = pgTable('devices', { ... });
export const sites = pgTable('sites', { ... });
export const salesData = pgTable('sales_data', { ... });
export const products = pgTable('products', { ... });
// do this for all ur tables

if u got a barrel file like src/db/index.ts make sure its re-exporting:

export * from './schema';
```

**2. next/document in app router**

ur getting this error:
```
Error: <Html> should not be imported outside of pages/_document.

someone put pages router code in the app router which breaks everything

fix: search ur whole project for:

import { Html, Head, Main, NextScript } from 'next/document'

delete every single one of these imports. ur using app router so u cant use next/document at all

in app/layout.tsx just do:

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="ko">
      <body>{children}</body>
    </html>
  );
}

if theres app/404.tsx with <Html> tags just remove the import

then push it:

bash

npm run build   # test locally first
git add .
git commit -m "fix exports and remove next/document"
git push

railway should deploy fine after this. all those other warnings about xlsx and punycode dont actually break anything

lmk if it works ::)


Loading...