R
Railwayβ€’7mo ago
bbgun

Download built image from railway or ssh access to service.

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`);
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'
β¨― 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 πŸ™‚
GitHub
GitHub - cloudflare/html-rewriter-wasm: WebAssembly version of HTML...
WebAssembly version of HTMLRewriter. Contribute to cloudflare/html-rewriter-wasm development by creating an account on GitHub.
18 Replies
Percy
Percyβ€’7mo ago
Project ID: b880d42a-b80e-4f1e-b8f1-75cdd868eef0
bbgun
bbgunOPβ€’7mo ago
Project id: b880d42a-b80e-4f1e-b8f1-75cdd868eef0
Brody
Brodyβ€’7mo ago
is asyncify.js a file you have in your project?
bbgun
bbgunOPβ€’7mo ago
It's a part of the html-rewriter-wasm package
bbgun
bbgunOPβ€’7mo ago
No description
Brody
Brodyβ€’7mo ago
are you using nixpacks?
bbgun
bbgunOPβ€’7mo ago
but I think that weird require statement is messing up the nextjs bundler and on my built docker image I only see html_rewriter.js and html_rewriter_bg.wasm unless I replace that require line using patch-packages Using regular dockerfile to build. Wasn't able to port to nixpacks yet
Brody
Brodyβ€’7mo ago
and you have built and ran an image from this dockerfile locally?
bbgun
bbgunOPβ€’7mo ago
Yeah Basically added a patch file:
-const { awaitPromise, setWasmExports, wrap } = require(String.raw`./asyncify.js`);
+const { awaitPromise, setWasmExports, wrap } = require('./asyncify.js');
-const { awaitPromise, setWasmExports, wrap } = require(String.raw`./asyncify.js`);
+const { awaitPromise, setWasmExports, wrap } = require('./asyncify.js');
Then when I rebuild locally I do get the asyncify.js to be a part of the final docker image 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
Brodyβ€’7mo ago
specifically built an image, not simply ran npm run build?
bbgun
bbgunOPβ€’7mo ago
Yeah docker build and all
Brody
Brodyβ€’7mo ago
railway uses buildx and I assume you aren't but that really shouldn't matter
bbgun
bbgunOPβ€’7mo ago
Hm, I can try that locally Building with COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 should know shortly if its any different
Brody
Brodyβ€’7mo ago
sounds good
bbgun
bbgunOPβ€’7mo ago
Yep still looks good with buildx
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
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
(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
Brodyβ€’7mo 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?
bbgun
bbgunOPβ€’7mo 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
Brodyβ€’7mo ago
and if the file wasn't there, what would you do
Want results from more Discord servers?
Add your server