How to debug failed Forge deploy?

Is there any way to get insight into why a forge deploy fails? I have written a small Forge app and after adding and importing the googleapis package deployments fail (forge version 0.27.0).

I have tried to run forge deploy --verbose which leads to the following log (failure at Snapshotting functions stage) but does not really provide more insight:

     ... (removed successful log events)
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Validate manifest",
            "createdAt": "2020-12-22T08:02:09.571Z",
            "newStatus": "DONE"
          }
        ]
      },
      {
        "description": "Snapshotting functions",
        "events": [
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2020-12-22T08:02:09.572Z",
            "newStatus": "STARTED"
          },
          {
            "__typename": "AppDeploymentLogEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2020-12-22T08:02:19.484Z",
            "message": "Deployment failed with unknown error",
            "level": "ERROR"
          },
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2020-12-22T08:02:19.485Z",
            "newStatus": "FAILED"
          }
        ]
      },
      {
        "description": "Deploying to environment",
        "events": []
      }
    ]
  }
}
  Deployment failed with unknown error

Error: Deployment failed

Error: Deployment failed
    at ArtifactDeployer.handleErrorEvent (/usr/local/lib/node_modules/@forge/cli/out/deploy/deployer/deployer.js:135:15)
    at ArtifactDeployer.pollAndCheckEvents (/usr/local/lib/node_modules/@forge/cli/out/deploy/deployer/deployer.js:61:18)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async ArtifactDeployer.monitorDeployment (/usr/local/lib/node_modules/@forge/cli/out/deploy/deployer/deployer.js:72:28)
    at async ArtifactDeployer.deploy (/usr/local/lib/node_modules/@forge/cli/out/deploy/deployer/deployer.js:36:9)
    at async PackageUploadDeployCommand.execute (/usr/local/lib/node_modules/@forge/cli/out/deploy/package-upload-deploy.js:14:9)
    at async CommandLineUI.displayProgress (/usr/local/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/ui/command-line-ui.js:44:28)
    at async DeployView.reportDeploymentProgress (/usr/local/lib/node_modules/@forge/cli/out/command-line/view/deploy-view.js:31:24)
    at async DeployController.run (/usr/local/lib/node_modules/@forge/cli/out/command-line/controller/deploy-controller.js:58:27)
    at async Command.actionProcessor (/usr/local/lib/node_modules/@forge/cli/out/command-line/command.js:60:32)

I wonder if this is due to beta limitations e.g. unsupported built-in Node modules. Would Forge fail at the snapshotting functions stage if it fails due to unsupported Node modules or would that rather be a runtime error?

Hi @tbinna,

The error message here seems inadequate so I’ve created https://ecosystem.atlassian.net/browse/FRGE-195.

I’ll reach out to the Forge team to see if they can help you proceed.

Regards,
Dugald

Hi @tbinna, could you provide log output that includes a traceId or requestId?

Snapshots have known to fail on things such as large buffers, could you try bypass the snapshot by adding this to your manifest under the app entry:

runtime:
  snapshots: false

https://developer.atlassian.com/platform/forge/manifest-reference/runtime/#snapshot-context for more info

2 Likes

@nhur, it seems that by disabling the snapshots it works.

I will PM you the log output of a failed deployment (when snapshots are enabled)

Thanks!

Hi @nhur / @dmorrow ,

seems like I’m running into the same issue, but disabling snapshots doesn’t fix it for me.

This happens with a new app created by forge create from forge CLI 0.27.0 where the CLI created a UI-Kit -> confluence macro module for me.

When I run forge deploy with modifying the manifest I get this:

Request ID: ba2bba1a96c20b1b
...
      {
        "description": "Snapshotting functions",
        "events": [
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2021-01-18T09:12:15.630Z",
            "newStatus": "STARTED"
          },
          {
            "__typename": "AppDeploymentLogEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2021-01-18T09:12:15.914Z",
            "message": "Deployment failed with unknown error",
            "level": "ERROR"
          },
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Generate snapshot step",
            "createdAt": "2021-01-18T09:12:15.916Z",
            "newStatus": "FAILED"
          }

After disabling snapshot it fails at a different stage:

Request ID: 8799f0a1c2fffec6


          {
            "__typename": "AppDeploymentLogEvent",
            "stepName": "Release Lambda functions",
            "createdAt": "2021-01-18T09:52:37.234Z",
            "message": "Deploying function \"main\" for the first time",
            "level": "INFO"
          },
          {
            "__typename": "AppDeploymentLogEvent",
            "stepName": "Release Lambda functions",
            "createdAt": "2021-01-18T09:52:39.769Z",
            "message": "Deployment failed with unknown error",
            "level": "ERROR"
          },
          {
            "__typename": "AppDeploymentTransitionEvent",
            "stepName": "Release Lambda functions",
            "createdAt": "2021-01-18T09:52:39.770Z",
            "newStatus": "FAILED"
          }

Is there something I can do to fix this?

Thanks!

Hi @jens, I tried looking at the logs for your deployment and couldn’t find anything specific — was this an unmodified app from the template? I’d be happy to look at your app code to try to debug it (feel free to DM)

Hi @jens, are you by any chance using NodeJS v15? Type node --version to determine what version you are using.

We’ve had someone experience the same issue as you when using NodeJS v15. The Forge CLI currently only supports NodeJS LTS versions (of which NodeJS v14 is the latest). Can you install NodeJS v14, run node --version to double check you’re using the version 14 of Node and try running forge deploy again?

Yes, this worked! Thanks a lot.

I followed the Getting Started page in the docs which only says that docker and node are required. As I had those already installed I didn’t read their specific installation instructions (on the OS-specific pages).
Maybe you could add a quick note on the getting started page about the LTS requirement to prevent others from falling into the same pit, or even add a runtime check to the CLI :slight_smile: