Download built image from railway or ssh access to service.
spread-admin
HOBBYOP

2 years ago

Hey folks. I'm debugging an issue with my deployment and it would really help if there was a way to have ssh access to my service or to download the docker image and run some commands on it. Is that something that's possible?

My issue is with the following package https://github.com/cloudflare/html-rewriter-wasm
Locally it works but I think that due to how its built the following line messes with the bundler:

const { awaitPromise, setWasmExports, wrap } = require(String.raw`./asyncify.js`);

and asyncify.js is missing from the end bundle which causes the following error on my deployed service:

⨯ Error: Cannot find module './asyncify.js'

I verified that by using patch-packages and on my locally built docker the file is now present, however the issue persists on the railway built and deployed

Would appreciate any help on this 🙂

0 Replies

spread-admin
HOBBYOP

2 years ago

Project id: b880d42a-b80e-4f1e-b8f1-75cdd868eef0


brody
EMPLOYEE

2 years ago

is asyncify.js a file you have in your project?


spread-admin
HOBBYOP

2 years ago

It's a part of the html-rewriter-wasm package


spread-admin
HOBBYOP

2 years ago

1233489910938337300


brody
EMPLOYEE

2 years ago

are you using nixpacks?


spread-admin
HOBBYOP

2 years ago

but I think that weird require statement is messing up the nextjs bundler and on my built docker image I only see htmlrewriter.js and htmlrewriter_bg.wasm unless I replace that require line using patch-packages


spread-admin
HOBBYOP

2 years ago

Using regular dockerfile to build. Wasn't able to port to nixpacks yet


brody
EMPLOYEE

2 years ago

and you have built and ran an image from this dockerfile locally?


spread-admin
HOBBYOP

2 years ago

Yeah


spread-admin
HOBBYOP

2 years ago

Basically added a patch file:

-const { awaitPromise, setWasmExports, wrap } = require(String.raw`./asyncify.js`);
+const { awaitPromise, setWasmExports, wrap } = require('./asyncify.js');

spread-admin
HOBBYOP

2 years ago

Then when I rebuild locally I do get the asyncify.js to be a part of the final docker image


spread-admin
HOBBYOP

2 years ago

My hunch is that the patch isnt applied while building on railway, to verify that I'd need to access to end image and review the file system, hence my request above 🙂


brody
EMPLOYEE

2 years ago

specifically built an image, not simply ran npm run build?


spread-admin
HOBBYOP

2 years ago

Yeah docker build and all


brody
EMPLOYEE

2 years ago

railway uses buildx and I assume you aren't but that really shouldn't matter


spread-admin
HOBBYOP

2 years ago

Hm, I can try that locally


spread-admin
HOBBYOP

2 years ago

Building with COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 should know shortly if its any different


brody
EMPLOYEE

2 years ago

sounds good


spread-admin
HOBBYOP

2 years ago

Yep still looks good with buildx


spread-admin
HOBBYOP

2 years ago

docker run --rm -it --entrypoint /bin/sh test-service
/app $ ls /app/node_modules/html-rewriter-wasm/dist/
asyncify.js            html_rewriter.js       html_rewriter_bg.wasm

spread-admin
HOBBYOP

2 years ago

(and just to re-iterate, if I don't use the patch above, the asyncify.js file doesn't exist, which casues the "cannot find module" error above)


brody
EMPLOYEE

2 years ago

say you did have ssh and you logged in and saw that there was no asyncify.js file in the /node_modules/html-rewriter-wasm/dist/ folder, what would you do then?


spread-admin
HOBBYOP

2 years ago

Basically run the command above and check if asyncify.js is there or not. If it's not then I know my patch isn't being applied, if it is then I'd have to go back to the drawing board 😅


brody
EMPLOYEE

2 years ago

and if the file wasn't there, what would you do


Loading...