Skip to Content
DeploymentsRedeploy

Redeploy

Update an existing app by passing a new files map and setting allowExistingApp / allow_existing_app to true.

Start a deployment

allowExistingApp / allow_existing_app is required when the app name already exists in your namespace.

redeployFromFiles.js
1
// Request: appName, owner, files, allowExistingApp: true
2
const deployment = await client.deployments.create({
3
  appName: "hello-stackmachine",
4
  owner: "stackmachine",
5
  allowExistingApp: true, // required when redeploying an app that already exists
6
  files: {
7
    "index.html": "<html><body><h1>Updated</h1></body></html>",
8
  },
9
});
10
// Should return: {// { ... }
15
console.log(deployment.buildId, deployment.status);

Wait for the build

Same as a first deploy: call wait() on the returned deployment until the new version is live.

redeployFromFiles.js
1
const appVersion = await deployment.wait({
2
  onProgress: ({ kind, message }) => console.log(kind, message),
3
});
4
// Should return: {// { ... }
8
console.log(appVersion.app.url);

Source: stackmachine/sdks  examples.