-
Notifications
You must be signed in to change notification settings - Fork 55
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
TypeError: form_data_1.default is not a constructor when adding attachment #327
Comments
I'm also experiencing this issue using just plain NodeJS. Any advice would be appreciated! |
I'm also having the issue |
The newer library better supports modules and is written in TypeScript. The FormData interface is a drop-in replacement except for getHeaders(), but that didn't do anything useful, so it can be dropped. Closes MrRefactoring#327 Signed-off-by: Matyáš Kroupa <[email protected]>
The newer library better supports modules and is written in TypeScript. The FormData interface is a drop-in replacement except for getHeaders(), but that didn't do anything useful, so it can be dropped. Closes #327 Signed-off-by: Matyáš Kroupa <[email protected]> Co-authored-by: Matyáš Kroupa <[email protected]> Co-authored-by: Vladislav Tupikin <[email protected]>
Any hope of getting a patch release on the 4.x line with this fix? We've recently started running into this issue and are looking for a fix or workaround. |
I've just reviewed the |
- Implemented `Buffer` to `File` conversion for attachment uploads. - Added `attachment.mimeType` an optional property. - Added automatic MIME type detection based on file extensions.
… v18.x.x by using `File` from `formdata-node`. - Enhanced documentation with TSDoc and examples for better clarity.
…port (#341) * #327: Package `form-data` replaced to `formdata-node` for add esm support * #327: Add `Buffer` type support using `formdata-node` package - Implemented `Buffer` to `File` conversion for attachment uploads. - Added `attachment.mimeType` an optional property. - Added automatic MIME type detection based on file extensions. * #327: Fixed the issue with the absence of the `File` class in Node.js v18.x.x by using `File` from `formdata-node`. - Enhanced documentation with TSDoc and examples for better clarity.
Thank you to everyone who participated in this discussion. Special thanks to Matyáš Kroupa (@krouma) for proposing the fix. I plan to include this improvement in version 4.0.4. |
- Improved the tree shaking process to ensure unused code is properly eliminated across the entire library. - Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
The newer library better supports modules and is written in TypeScript. The FormData interface is a drop-in replacement except for getHeaders(), but that didn't do anything useful, so it can be dropped. Closes #327 Signed-off-by: Matyáš Kroupa <[email protected]> Co-authored-by: Matyáš Kroupa <[email protected]> Co-authored-by: Vladislav Tupikin <[email protected]>
* #327: Package `form-data` replaced to `formdata-node` for add esm support (#341) * #327: Package `form-data` replaced to `formdata-node` for add esm support * #327: Add `Buffer` type support using `formdata-node` package - Implemented `Buffer` to `File` conversion for attachment uploads. - Added `attachment.mimeType` an optional property. - Added automatic MIME type detection based on file extensions. * #327: Fixed the issue with the absence of the `File` class in Node.js v18.x.x by using `File` from `formdata-node`. - Enhanced documentation with TSDoc and examples for better clarity. * #320: Fix tree shaking mechanism and remove circular dependencies (#343) - Improved the tree shaking process to ensure unused code is properly eliminated across the entire library. - Refactored the codebase to resolve circular dependencies, improving tree shaking and maintainability.
Thank you! Looks like this is working well now (with 4.0.5)! I did need to add Buffer.from when using string content, and am now passing an explicit mimeType. |
When attempting to add an attachment using the latest version of jira.js in an Astro project with Node.js v20.10.0, I encounter the following error:
TypeError: form_data_1.default is not a constructor
Steps to Reproduce:
Environment:
Node.js: v20.10.0
typescript: "^5.6.2"
Astro: "^4.15.11",
jira.js: "^4.0.2",
xlsx-populate: "^1.21.0"
form-data: "^4.0.1",
Additional Context:
The error originates from issueAttachments.ts#L426 where it attempts to instantiate form_data_1.default. It appears that the form-data module isn't being imported correctly in an ESM context.
At version "jira.js": "^2.15.5", everything works correctly.
The text was updated successfully, but these errors were encountered: