Javascript not loading sveltekit
jollygrin
HOBBYOP

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

Closed

141 Replies

jollygrin
HOBBYOP

2 years ago

ProjectID:

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


jollygrin
HOBBYOP

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

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

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

2 years 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 years ago

Hello!

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



spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

js isn't loading


spacemandev-git
PRO

2 years 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 years ago

deployed with the same dockerfile?


spacemandev-git
PRO

2 years ago

yup


spacemandev-git
PRO

2 years ago

same exact github repo with docker file in it


spacemandev-git
PRO

2 years ago

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


2 years ago

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


spacemandev-git
PRO

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

2 years ago

yes


spacemandev-git
PRO

2 years ago

can try without it, using bun run preview


spacemandev-git
PRO

2 years ago

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


2 years ago

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


2 years ago

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


spacemandev-git
PRO

2 years ago

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


2 years ago

i dont think thats the direction we want to go in


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

happy to try whatever else


spacemandev-git
PRO

2 years ago

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


2 years ago

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


spacemandev-git
PRO

2 years ago

would prefer not to :/


spacemandev-git
PRO

2 years ago

but can try for testing


2 years ago

yes please


2 years ago

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


spacemandev-git
PRO

2 years ago

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


2 years ago

i cannot recommend nixpacks, but i can recommend Railpack


spacemandev-git
PRO

2 years ago

right, but switching the builder should be enough?


spacemandev-git
PRO

2 years ago

or do i need to do anything else?


2 years ago

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


spacemandev-git
PRO

2 years ago

gotcha trying now with railpack


2 years ago

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


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

can rollback after testing


2 years ago

fair enough


spacemandev-git
PRO

2 years ago

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


2 years ago

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


spacemandev-git
PRO

2 years ago

hmm some errors with deps one sec


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

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


2 years ago

probably with RAILPACK_INSTALL_CMD


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago


2 years ago

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


2 years ago

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

spacemandev-git
PRO

2 years ago

deploying


2 years ago

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


spacemandev-git
PRO

2 years 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 years ago

interesting approach, just use what i provided haha


spacemandev-git
PRO

2 years ago

1354657397997568132


spacemandev-git
PRO

2 years ago

uh, not sure what's causing this


2 years ago

one sec


spacemandev-git
PRO

2 years ago

no dockerfile in folder if it helps


spacemandev-git
PRO

2 years ago

moved it out


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

2 years ago

one sec, updating


2 years ago

updated the Dockerfile


spacemandev-git
PRO

2 years ago

yup yup


2 years ago

how was bun coping with the dep conflict?


spacemandev-git
PRO

2 years ago

no idea, it just handled it


spacemandev-git
PRO

2 years ago

didn't give errors


spacemandev-git
PRO

2 years ago

i blew away package lock, rebuilding


2 years ago

well you still need it haha


spacemandev-git
PRO

2 years ago

1354660871758151740


spacemandev-git
PRO

2 years ago

something to do with package fetch maybe?


2 years ago

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


spacemandev-git
PRO

2 years ago

oh i forgot a git add


spacemandev-git
PRO

2 years ago

pushing with the lock


spacemandev-git
PRO

2 years ago

uhhhh

1354661448709705748


spacemandev-git
PRO

2 years ago

maybe i need to install tailwind differently for node?


2 years ago

i've updated Dockerfile


spacemandev-git
PRO

2 years ago

gotcha one sec


spacemandev-git
PRO

2 years ago

looks like it's loading with js as well


spacemandev-git
PRO

2 years ago

so i guess bun issue somewhere?


2 years ago

okay the 3d onion is bouncing


2 years ago

we need to do one more test to rule that out


2 years ago

can you give me your original dockerfile?


spacemandev-git
PRO

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

2 years ago

let me get the one earlier than this


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

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

2 years ago

pushing with that


spacemandev-git
PRO

2 years ago

one sec


spacemandev-git
PRO

2 years ago

1354664498832609501


2 years ago

"/bun.lockb": not found


spacemandev-git
PRO

2 years ago

there is a bun.lock


spacemandev-git
PRO

2 years ago

newer version of bun


spacemandev-git
PRO

2 years ago

oh i'll update docker file to bun.lock


spacemandev-git
PRO

2 years ago

one sec


2 years ago

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


2 years ago

also, pro tip, click the view in context button


spacemandev-git
PRO

2 years ago

1354665134391300269


spacemandev-git
PRO

2 years ago

bun install couldn't be found???


spacemandev-git
PRO

2 years ago

in the bun dockerfile???


spacemandev-git
PRO

2 years ago

lol what


spacemandev-git
PRO

2 years ago

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


2 years ago

what is three-perf?


spacemandev-git
PRO

2 years ago

no idea


spacemandev-git
PRO

2 years ago

it's not even in deps


spacemandev-git
PRO

2 years ago

its' in lockfile


spacemandev-git
PRO

2 years ago

looks like threlte uses it?


spacemandev-git
PRO

2 years ago

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


2 years ago

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


spacemandev-git
PRO

2 years ago

hahahahaha i've been in cargo hell too


2 years ago

the only savior is go


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

oh maybe i need to add git in the dockerfile?


2 years ago

i dont think so, i say just try to redeploy


spacemandev-git
PRO

2 years ago

same error 😦


2 years ago

was worth a shot


2 years ago

back to node it is


spacemandev-git
PRO

2 years ago

this file right?


2 years ago

yeah


spacemandev-git
PRO

2 years ago

building


2 years ago

good old node


spacemandev-git
PRO

2 years ago

cool working, i'll move the domain over


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

also this was working fine for a long time


spacemandev-git
PRO

2 years ago

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


2 years ago

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


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

it was building everything with bun


spacemandev-git
PRO

2 years ago

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


2 years ago

bun is a mystery


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

thanks


2 years ago

sounds good, glad i could help


spacemandev-git
PRO

2 years ago

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


spacemandev-git
PRO

2 years ago

if it was a bun issue


spacemandev-git
PRO

2 years ago

cause it built from the same dockerfile


spacemandev-git
PRO

2 years ago

shrug


2 years ago

diffrent container runtime?, who really knows


jollygrin
HOBBYOP

2 years ago

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


2 years ago

interesting


Welcome!

Sign in to your Railway account to join the conversation.

Loading...