Javascript not loading sveltekit

jollygrinPRO

2 months 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.

0 Replies

jollygrinPRO

2 months ago

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


jollygrinPRO

2 months 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


jollygrinPRO

2 months 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


jollygrinPRO

2 months 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-gitPRO

2 months 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


2 months ago

Hello!

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



spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

js isn't loading


spacemandev-gitPRO

2 months 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)


2 months ago

deployed with the same dockerfile?


spacemandev-gitPRO

2 months ago

yup


spacemandev-gitPRO

2 months ago

same exact github repo with docker file in it


spacemandev-gitPRO

2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months 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-gitPRO

2 months ago

yes


spacemandev-gitPRO

2 months ago

can try without it, using bun run preview


spacemandev-gitPRO

2 months ago

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


2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months ago

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


2 months ago

i dont think thats the direction we want to go in


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

happy to try whatever else


spacemandev-gitPRO

2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months ago

would prefer not to :/


spacemandev-gitPRO

2 months ago

but can try for testing


2 months ago

yes please


2 months ago

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


spacemandev-gitPRO

2 months ago

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


2 months ago

i cannot recommend nixpacks, but i can recommend Railpack


spacemandev-gitPRO

2 months ago

right, but switching the builder should be enough?


spacemandev-gitPRO

2 months ago

or do i need to do anything else?


2 months ago

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


spacemandev-gitPRO

2 months ago

gotcha trying now with railpack


2 months ago

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


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

can rollback after testing


2 months ago

fair enough


spacemandev-gitPRO

2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months ago

hmm some errors with deps one sec


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

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


2 months ago

probably with RAILPACK_INSTALL_CMD


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago


2 months ago

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


2 months ago

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

spacemandev-gitPRO

2 months ago

deploying


2 months ago

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


spacemandev-gitPRO

2 months 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"
}

2 months ago

interesting approach, just use what i provided haha


spacemandev-gitPRO

2 months ago

1354657397997568300


spacemandev-gitPRO

2 months ago

uh, not sure what's causing this


2 months ago

one sec


spacemandev-gitPRO

2 months ago

no dockerfile in folder if it helps


spacemandev-gitPRO

2 months ago

moved it out


2 months 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-gitPRO

2 months ago

one sec, updating


2 months ago

updated the Dockerfile


spacemandev-gitPRO

2 months ago

yup yup


2 months ago

how was bun coping with the dep conflict?


spacemandev-gitPRO

2 months ago

no idea, it just handled it


spacemandev-gitPRO

2 months ago

didn't give errors


spacemandev-gitPRO

2 months ago

i blew away package lock, rebuilding


2 months ago

well you still need it haha


spacemandev-gitPRO

2 months ago

1354660871758151700


spacemandev-gitPRO

2 months ago

something to do with package fetch maybe?


2 months ago

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


spacemandev-gitPRO

2 months ago

oh i forgot a git add


spacemandev-gitPRO

2 months ago

pushing with the lock


spacemandev-gitPRO

2 months ago

uhhhh

1354661448709705700


spacemandev-gitPRO

2 months ago

maybe i need to install tailwind differently for node?


2 months ago

i've updated Dockerfile


spacemandev-gitPRO

2 months ago

gotcha one sec


spacemandev-gitPRO

2 months ago

looks like it's loading with js as well


spacemandev-gitPRO

2 months ago

so i guess bun issue somewhere?


2 months ago

okay the 3d onion is bouncing


2 months ago

we need to do one more test to rule that out


2 months ago

can you give me your original dockerfile?


spacemandev-gitPRO

2 months 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-gitPRO

2 months ago

let me get the one earlier than this


2 months 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-gitPRO

2 months 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"]

2 months 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-gitPRO

2 months ago

pushing with that


spacemandev-gitPRO

2 months ago

one sec


spacemandev-gitPRO

2 months ago

1354664498832609500


2 months ago

"/bun.lockb": not found


spacemandev-gitPRO

2 months ago

there is a bun.lock


spacemandev-gitPRO

2 months ago

newer version of bun


spacemandev-gitPRO

2 months ago

oh i'll update docker file to bun.lock


spacemandev-gitPRO

2 months ago

one sec


2 months ago

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


2 months ago

also, pro tip, click the view in context button


spacemandev-gitPRO

2 months ago

1354665134391300400


spacemandev-gitPRO

2 months ago

bun install couldn't be found???


spacemandev-gitPRO

2 months ago

in the bun dockerfile???


spacemandev-gitPRO

2 months ago

lol what


spacemandev-gitPRO

2 months ago

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


2 months ago

what is three-perf?


spacemandev-gitPRO

2 months ago

no idea


spacemandev-gitPRO

2 months ago

it's not even in deps


spacemandev-gitPRO

2 months ago

its' in lockfile


spacemandev-gitPRO

2 months ago

looks like threlte uses it?


spacemandev-gitPRO

2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months ago

hahahahaha i've been in cargo hell too


2 months ago

the only savior is go


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

oh maybe i need to add git in the dockerfile?


2 months ago

i dont think so, i say just try to redeploy


spacemandev-gitPRO

2 months ago

same error 😦


2 months ago

was worth a shot


2 months ago

back to node it is


spacemandev-gitPRO

2 months ago

this file right?


2 months ago

yeah


spacemandev-gitPRO

2 months ago

building


2 months ago

good old node


spacemandev-gitPRO

2 months ago

cool working, i'll move the domain over


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

also this was working fine for a long time


spacemandev-gitPRO

2 months ago

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


2 months ago

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


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

it was building everything with bun


spacemandev-gitPRO

2 months ago

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


2 months ago

bun is a mystery


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

thanks


2 months ago

sounds good, glad i could help


spacemandev-gitPRO

2 months ago

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


spacemandev-gitPRO

2 months ago

if it was a bun issue


spacemandev-gitPRO

2 months ago

cause it built from the same dockerfile


spacemandev-gitPRO

2 months ago

shrug


2 months ago

diffrent container runtime?, who really knows


jollygrinPRO

2 months ago

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


2 months ago

interesting