Javascript not loading sveltekit
jollygrin
HOBBYOP

a year ago

Having a bizzare issue of my deployed sveltekit app no longer serving the javascript for the site (standard js for opening dropdowns and stuff). The page loads fine, but indefinitely loads a hanging resource which never loads and then crashes the site.

The page has no error requests, and loads images that don't exist as 200 despite not content. No errors on railway logs.

Attempted to roll back to working branches, with the same issue persisting. Tried to delete and completely instantiate new instance but has the same issues.

Tried deploying on other services (digital ocean) and everything worked as expected.

141 Replies

jollygrin
HOBBYOP

a year ago

ProjectID:
2b6e2b92-e5d7-4be3-abf3-8524f4292c61


jollygrin
HOBBYOP

a year ago

Just had a hiccup of the javascript loading momentarily, but the static images did not load. I made an update to remove static image (use hosted elsewhere) and now the js is broken again.

When the JS was loading properly, was working on vivaldi but not chrome. On both i used incognito tabs with storage wiped.

Very bizzare, tricky to debug


jollygrin
HOBBYOP

a year ago

heres a video demonstrating the issue of components that need javascript (days until counter in top left uses new Date, and the dropdown a simple state boolean)

1354536937955791110


jollygrin
HOBBYOP

a year ago

also shows no failing requests or error logs, which makes it very challenging to debug.

And to reiterate, this problem did not occur on fresh install to digital ocean. And reverting to a working backup maintained the same problems. Including when making a brand new railway instance


spacemandev-git
PRO

a year ago

(i work with jolly on this)
we had to migrate to digital ocean for now until this is fixed 😦

really would appreciate to be back on railway


brody
EMPLOYEE

a year ago

Hello!

Can I see a link to this site that is hosted on Railway please?



spacemandev-git
PRO

a year ago

you'll the top left counter is "0" days and hamburger menu doesn't work on the top right


spacemandev-git
PRO

a year ago

js isn't loading


spacemandev-git
PRO

a year ago

same branch/commit on https://oniondao.dev < hosted on digital ocean (DNS is still updating so you might get redirection to railway in some cases)


brody
EMPLOYEE

a year ago

deployed with the same dockerfile?


spacemandev-git
PRO

a year ago

yup


spacemandev-git
PRO

a year ago

same exact github repo with docker file in it


spacemandev-git
PRO

a year ago

using DO's app platform (same as railway github deploy)


brody
EMPLOYEE

a year ago

on Railway you have a custom start command, are you also using that start command on DO?


spacemandev-git
PRO

a year ago

one thing i thougth the error might be was we were initially on metal servers, switched to non metal servers, but still error persisted


spacemandev-git
PRO

a year ago

yes


spacemandev-git
PRO

a year ago

can try without it, using bun run preview


spacemandev-git
PRO

a year ago

one sec (don't think it'll change anything, but i'll try it)


brody
EMPLOYEE

a year ago

when i load the Railway hosted site im seeing 3 requests for JS files that are stuck pending


brody
EMPLOYEE

a year ago

well since removing the start command you are now running a dev server


spacemandev-git
PRO

a year ago

yes trying to see if that forces the files to be served any better


brody
EMPLOYEE

a year ago

i dont think thats the direction we want to go in


spacemandev-git
PRO

a year ago

ideally would use build + start command, but just trying to get it working


spacemandev-git
PRO

a year ago

happy to try whatever else


spacemandev-git
PRO

a year ago

even with bun run preview it's still not loading the js files


brody
EMPLOYEE

a year ago

The dockerfile uses bun, any change you are down to switch to that to Node?


spacemandev-git
PRO

a year ago

would prefer not to :/


spacemandev-git
PRO

a year ago

but can try for testing


brody
EMPLOYEE

a year ago

yes please


brody
EMPLOYEE

a year ago

i also put the start command back for you, it will be used on the next deploy you do


spacemandev-git
PRO

a year ago

switching to nixpacks as builder instead of dockerfile should auto use node right?


brody
EMPLOYEE

a year ago

i cannot recommend nixpacks, but i can recommend Railpack


spacemandev-git
PRO

a year ago

right, but switching the builder should be enough?


spacemandev-git
PRO

a year ago

or do i need to do anything else?


brody
EMPLOYEE

a year ago

you would need to delete or rename the Dockerfile to switch to either nixpacks or railpack


spacemandev-git
PRO

a year ago

gotcha trying now with railpack


brody
EMPLOYEE

a year ago

but probably dont wanna do that since you said you have DO hooked up to the same repo?


spacemandev-git
PRO

a year ago

yea but it'll just crash for now that's fine


spacemandev-git
PRO

a year ago

can rollback after testing


brody
EMPLOYEE

a year ago

fair enough


spacemandev-git
PRO

a year ago

like i really would prefer to get railway working, much prefer you guys to DO


brody
EMPLOYEE

a year ago

want to temporarily remove your bun lock file so that node and only node is used?


spacemandev-git
PRO

a year ago

hmm some errors with deps one sec


spacemandev-git
PRO

a year ago

whats the best way to pass in a flag for npm install step in Railpack?


spacemandev-git
PRO

a year ago

need to pass in "--legacy-peer-deps"


brody
EMPLOYEE

a year ago

probably with RAILPACK_INSTALL_CMD


spacemandev-git
PRO

a year ago

does that go in railway.json or in railpack.json something like that?


spacemandev-git
PRO

a year ago


brody
EMPLOYEE

a year ago

its a service variable, but if you prefer putting it in a config file you could do railpack.json


brody
EMPLOYEE

a year ago

{
  "$schema": "https://schema.railpack.com",
  "steps": {
    "install": {
      "commands": ["npm install --legacy-peer-deps"]
    }
  }
}

spacemandev-git
PRO

a year ago

deploying


brody
EMPLOYEE

a year ago

what did you end up putting in the railpack.json?


spacemandev-git
PRO

a year ago

{
    "$schema": "https://schema.railpack.com",
    "steps": {
      "install": {
        "commands": ["npm install --legacy-peer-deps"]
      },
      "build": {
        "commands": ["npm run build"]
      },
      "start": {
        "commands": ["node build/index.js"]
      }
    },
    "provider": "railway"
}

brody
EMPLOYEE

a year ago

interesting approach, just use what i provided haha


spacemandev-git
PRO

a year ago

1354657397997568300


spacemandev-git
PRO

a year ago

uh, not sure what's causing this


brody
EMPLOYEE

a year ago

one sec


spacemandev-git
PRO

a year ago

no dockerfile in folder if it helps


spacemandev-git
PRO

a year ago

moved it out


brody
EMPLOYEE

a year ago

ill have to raise this issue with railpack, but for now did you want to move back to a Dockerfile? -

FROM node:22-slim

ENV NPM_CONFIG_UPDATE_NOTIFIER=false
ENV NPM_CONFIG_FUND=false

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci --legacy-peer-deps

COPY . ./

RUN npm run build

ENTRYPOINT ["node", "build/index.js"]

spacemandev-git
PRO

a year ago

one sec, updating


brody
EMPLOYEE

a year ago

updated the Dockerfile


spacemandev-git
PRO

a year ago

yup yup


brody
EMPLOYEE

a year ago

how was bun coping with the dep conflict?


spacemandev-git
PRO

a year ago

no idea, it just handled it


spacemandev-git
PRO

a year ago

didn't give errors


spacemandev-git
PRO

a year ago

i blew away package lock, rebuilding


brody
EMPLOYEE

a year ago

well you still need it haha


spacemandev-git
PRO

a year ago

1354660871758151700


spacemandev-git
PRO

a year ago

something to do with package fetch maybe?


brody
EMPLOYEE

a year ago

no, its a hidden error, you are missing a package-lock.json file


spacemandev-git
PRO

a year ago

oh i forgot a git add


spacemandev-git
PRO

a year ago

pushing with the lock


spacemandev-git
PRO

a year ago

uhhhh

1354661448709705700


spacemandev-git
PRO

a year ago

maybe i need to install tailwind differently for node?


brody
EMPLOYEE

a year ago

i've updated Dockerfile


spacemandev-git
PRO

a year ago

gotcha one sec


spacemandev-git
PRO

a year ago

looks like it's loading with js as well


spacemandev-git
PRO

a year ago

so i guess bun issue somewhere?


brody
EMPLOYEE

a year ago

okay the 3d onion is bouncing


brody
EMPLOYEE

a year ago

we need to do one more test to rule that out


brody
EMPLOYEE

a year ago

can you give me your original dockerfile?


spacemandev-git
PRO

a year ago

FROM oven/bun:latest

COPY . /app

WORKDIR /app

RUN bun install

RUN bun run build

EXPOSE 4173

CMD ["bun", "run", "preview", "--host"]

this is the editted one i was trying


spacemandev-git
PRO

a year ago

let me get the one earlier than this


brody
EMPLOYEE

a year ago

that one is fine, i have a theory, when you where using that bun Dockerfile, you still had the railway start command set to use node, thus you built with bun, but never ran with bun, I'm going to modify that dockerfile to also run with bun


spacemandev-git
PRO

a year ago

i think this was the one before i started editting:

FROM oven/bun:1.2

# Set working directory
WORKDIR /app

# Copy package files
COPY package.json ./

# Copy the original package.json back
COPY package.json ./

# Install all dependencies
RUN bun install --no-production

# Copy application code
COPY . .

# Build the application
RUN bun run build

# Expose the port
EXPOSE 3000
ENV PORT=3000
ENV HOST=0.0.0.0

# Start the application
CMD ["node", "build/index.js"]

brody
EMPLOYEE

a year ago

bring your bun lockfile back and try this simple dockerfile -

FROM oven/bun:latest

WORKDIR /app

COPY package.json bun.lock ./

RUN bun install

COPY . ./

RUN bun run build

CMD ["bun", "build/index.js"]

spacemandev-git
PRO

a year ago

pushing with that


spacemandev-git
PRO

a year ago

one sec


spacemandev-git
PRO

a year ago

1354664498832609500


brody
EMPLOYEE

a year ago

"/bun.lockb": not found


spacemandev-git
PRO

a year ago

there is a bun.lock


spacemandev-git
PRO

a year ago

newer version of bun


spacemandev-git
PRO

a year ago

oh i'll update docker file to bun.lock


spacemandev-git
PRO

a year ago

one sec


brody
EMPLOYEE

a year ago

ah text based lock file, i've also updated the Dockerfile


brody
EMPLOYEE

a year ago

also, pro tip, click the view in context button


spacemandev-git
PRO

a year ago

1354665134391300400


spacemandev-git
PRO

a year ago

bun install couldn't be found???


spacemandev-git
PRO

a year ago

in the bun dockerfile???


spacemandev-git
PRO

a year ago

lol what


spacemandev-git
PRO

a year ago

oh it's something to do with three-perf?


brody
EMPLOYEE

a year ago

what is three-perf?


spacemandev-git
PRO

a year ago

no idea


spacemandev-git
PRO

a year ago

it's not even in deps


spacemandev-git
PRO

a year ago

its' in lockfile


spacemandev-git
PRO

a year ago

looks like threlte uses it?


spacemandev-git
PRO

a year ago

not sure why it's failling to clone now but was working before?


brody
EMPLOYEE

a year ago

we love when packages run git clones, the node ecosystem is lovely


spacemandev-git
PRO

a year ago

hahahahaha i've been in cargo hell too


brody
EMPLOYEE

a year ago

the only savior is go


spacemandev-git
PRO

a year ago

is there any reason git clone would be failing in this dockerfile?


spacemandev-git
PRO

a year ago

oh maybe i need to add git in the dockerfile?


brody
EMPLOYEE

a year ago

i dont think so, i say just try to redeploy


spacemandev-git
PRO

a year ago

same error 😦


brody
EMPLOYEE

a year ago

was worth a shot


brody
EMPLOYEE

a year ago

back to node it is


spacemandev-git
PRO

a year ago

this file right?


brody
EMPLOYEE

a year ago

yeah


spacemandev-git
PRO

a year ago

building


brody
EMPLOYEE

a year ago

good old node


spacemandev-git
PRO

a year ago

cool working, i'll move the domain over


spacemandev-git
PRO

a year ago

fwiw, we have two other services running with bun with no issue (back end services though)


spacemandev-git
PRO

a year ago

also this was working fine for a long time


spacemandev-git
PRO

a year ago

like we had the front end service running with bun up til yesterday when it suddenly stopped serving files


brody
EMPLOYEE

a year ago

i think you had it running with node technically, given your start command


spacemandev-git
PRO

a year ago

oh true, but like we didn't change the start command


spacemandev-git
PRO

a year ago

it was building everything with bun


spacemandev-git
PRO

a year ago

just using node in the start command to serve the built files


brody
EMPLOYEE

a year ago

bun is a mystery


spacemandev-git
PRO

a year ago

anyway i'll move the domain over and just use node


spacemandev-git
PRO

a year ago

thanks


brody
EMPLOYEE

a year ago

sounds good, glad i could help


spacemandev-git
PRO

a year ago

i am also curious why DO wasn't having this problem


spacemandev-git
PRO

a year ago

if it was a bun issue


spacemandev-git
PRO

a year ago

cause it built from the same dockerfile


spacemandev-git
PRO

a year ago

shrug


brody
EMPLOYEE

a year ago

diffrent container runtime?, who really knows


jollygrin
HOBBYOP

a year ago

I believe it's a debug tool buried within the threejs package


brody
EMPLOYEE

a year ago

interesting


Loading...