Bundling failed: Module not found

I’m building a Forge application uploading files to remote server with formdata-node, and I get below error while bundling. Anyone ever seen this? Or is there any limits with Forge bundling?

Reloading code…

=== Running forge lint…
No issues found.

=== Bundling code…

Error: Bundling failed: Module not found: Error: Can’t resolve ‘formdata-node/file-from-path’ in ‘/app/src/testrail’

Here is my package.json

  "name": "jira-test-plugin",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "private": true,
  "scripts": {
    "lint": "./node_modules/.bin/eslint src/**/* || npm run --silent hook-errors",
    "clean": "rm -fr node_modules",
    "hook-errors": "echo '\\x1b[31mThe build failed because a Forge UI hook is being used incorrectly. Forge UI hooks follow the same rules as React Hooks but have their own API definitions. See the Forge documentation for details on how to use Forge UI hooks.\n' && exit 1"
  "devDependencies": {
    "eslint": "^8.25.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "@types/jest": "26.0.14",
    "@types/node": "14.17.0",
    "@typescript-eslint/eslint-plugin": "5.37.0",
    "@typescript-eslint/parser": "5.37.0",
    "eslint-plugin-jsdoc": "39.3.6",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "jest": "28.1.3",
    "jest-junit": "12.2.0",
    "ts-jest": "28.0.8",
    "ts-loader": "9.3.1",
    "ts-node": "10.9.1",
    "typescript": "4.7.4"
  "dependencies": {
    "@forge/api": "^2.6.0",
    "@forge/resolver": "^1.4.2",
    "@forge/ui": "1.4.0",
    "agentkeepalive": "4.2.0",
    "axios": "0.21.1",
    "axios-retry": "3.2.4",
    "form-data-encoder": "1.7.2",
    "formdata-node": "^5.0.0",
    "https-proxy-agent": "5.0.0",
    "log4js": "6.4.0",
    "socks-proxy-agent": "5.0.0"

and the typescript file importing 'formdata-node",

import { Logger } from "../util/Logger";

import { FormDataEncoder } from "form-data-encoder";
import { FormData } from "formdata-node";
import { fileFromPathSync } from "formdata-node/file-from-path";

export class TestRailClient {

    public uploadAttachment(url: string, name: string, filepath: string): void {
        const form = new FormData();
        try {
            form.set("attachment", fileFromPathSync(filepath), name);
            const encoder = new FormDataEncoder(form);
            // return this.handleResponse(this.axiosInstance.post(url, Readable.from(encoder), {headers: encoder.headers})) as Promise<AttachmentUploadResult>;
        } catch (error) {
            throw error; 


I’ve run into this problem with fordata-node and a number of other packages. I believe this is due to various unsupported Node.js modules in Forge.

When it comes to posting files using multipart/form-data there are also limitations tracked at: [FRGE-114] - Ecosystem Jira

Using application/x-www-form-urlencoded might be a workaround if the API you’re connecting to supports this.

thanks @Judd .