Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom::AssetReplacer - socket hang up #42

Open
leanderiversen opened this issue Feb 5, 2025 · 1 comment · May be fixed by #43
Open

Custom::AssetReplacer - socket hang up #42

leanderiversen opened this issue Feb 5, 2025 · 1 comment · May be fixed by #43

Comments

@leanderiversen
Copy link
Contributor

leanderiversen commented Feb 5, 2025

Hi,

We have been trying to upgrade past 2.44.3, as our smaller sites are running 2.47.1 without issues. However, when we try to upgrade to any version past 2.44.3, we are getting intermittent errors that says defaultServerFunction/AssetReplacer Custom::AssetReplacer UPDATE_FAILED Received response status [FAILED] from custom resource. Message returned: socket hang up.

This does not happen on every deployment, but happens frequently enough that we have to downgrade to 2.44.3 again.

Thank you.

@leanderiversen leanderiversen linked a pull request Feb 5, 2025 that will close this issue
@wpoynter
Copy link
Contributor

After guidance from a user on Discord, I got it working...

Using yarn patch sst, I created the following patch which has solved the issue

diff --git a/support/custom-resources/index.mjs b/support/custom-resources/index.mjs
index e3cd5430b98b9a232d7d50300921c768b301fdb8..8e2f6d2c4298e1b831bd02342b20dfca58fd837b 100644
--- a/support/custom-resources/index.mjs
+++ b/support/custom-resources/index.mjs
@@ -132567,11 +132567,12 @@ async function download(bucket, key) {
 }
 async function upload(bucket, key) {
   console.log("upload");
+  const fileBuffer = fs.readFileSync(zipPath);
   await s3.send(
     new import_client_s3.PutObjectCommand({
       Key: key,
       Bucket: bucket,
-      Body: fs.createReadStream(zipPath)
+      Body: fileBuffer
     })
   );
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants