Can't `expo publish`, "socket hang up"

#1

Hi all, I’m trying to automate the process of expo publish from a VM running on Google Compute Engine. The idea is to have a publicly accessible script to update a database that is part of the app and publish it, so users can get the latest version as an asset. The script works fine on my Windows 10 computer but I can’t get expo publish to work on the VM and I can’t figure out why.

expo --version gives 2.6.14 on either machine and they’re both running the same node and npm versions.

The exact command run is expo publish --config [...] --release-channel auto-push --max-workers 1 --non-interactive and following is some sample output:

[03:22:05] Unable to find an existing Expo CLI instance for this directory, starting a new one...
[03:22:35] Starting Metro Bundler on port 19001.
[03:22:38] Tunnel ready.
[03:22:38] Publishing to channel 'auto-push'...
[03:22:38] We noticed you did not build a standalone app with this SDK version and release channel before. Remember that OTA updates will not work with the app built with different SDK version and/or release channel. Read more: https://docs.expo.io/versions/latest/guides/publishing.html#limitations
[03:22:39] Building iOS bundle
Building JavaScript bundle [=                                                                                  ] 1
[03:24:30] Tunnel connected.
[03:25:12] We noticed your tunnel is having issues. This may be due to intermittent problems with our tunnel provider. If you have trouble connecting to your app, try to Restart the project, or switch Host to LAN.
Building JavaScript bundle [=                                                                                  ] 1 [03:25:12] Tunnel connected.
[03:25:14] socket hang up
[03:25:14] Error: socket hang up                                                                                   
    at createHangUpError (_http_client.js:322:15)
    at Socket.socketOnEnd (_http_client.js:425:23)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I have also tried running expo start --localhost --max-workers 1 --offline --non-interactive --config [...] before the publish but the result is the same. Same with --lan.

Btw, the warning about SDK versions is because we were previously on v29 and now we’re on v32, we haven’t done a build or publish to production yet. Doubt this is the cause of the problem, because this runs normally on my computer.

Any and all other advice about automating this is also welcome. Thanks for your time!

#2

Hi, the socket hang up error during building JavaScript bundle could be a symptom of the Metro bundler process crashing for some reason (e.g. running out of memory: Error when running exp publish: socket hang up). The problem is that in this case there’s no stderr output from Metro before the socket hangup, so it’s pretty hard to say what’s causing this.

Since Node.js running out of heap space can sometimes cause this, could you try instead of expo publish use this command which sets a larger heap space for the Node process?

node --max-old-space-size=8192 $(which expo) publish --max-workers 1 --non-interactive [...]

Maybe this will help us rule out if it’s memory usage or something else.

#3

Oh that could definitely be the case, I’ve been using the free tier of the GCE which gives a mere 600MB of memory. It would make even more sense seeing as the VM works perfectly just up until the build starts, when even typing into the terminal is very slow. I will try a beefed-up instance and get back to you, thanks for the suggestion!

#4

Sure enough, I upgraded from the micro instance to n1-standard-1 with 3.75GB memory and publish was successful :tada:
That much memory might have been overkill, I’ll try a step down later, but the problem was definitely memory.
Thanks again for your help!

1 Like
closed #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.