Skip to content

Comments

fix(Kafka Node): Use lazy imports to fix build metadata generation#25794

Open
caloganathan wants to merge 1 commit inton8n-io:masterfrom
caloganathan:claude/fix-render-deployment-jE9mI
Open

fix(Kafka Node): Use lazy imports to fix build metadata generation#25794
caloganathan wants to merge 1 commit inton8n-io:masterfrom
caloganathan:claude/fix-render-deployment-jE9mI

Conversation

@caloganathan
Copy link

The newly added Kafka and KafkaTrigger nodes were failing during the build process when the metadata generation script tried to load them. The issue was that kafkajs and @kafkajs/confluent-schema-registry were being imported at the module level, which caused failures when loaded in the VM context during metadata generation.

This fix makes all kafkajs-related imports lazy by using dynamic imports (await import()) only when the node actually executes, allowing the metadata generation to complete successfully.

Changes:

  • Kafka.node.ts: Lazy load kafkajs and SchemaRegistry
  • KafkaTrigger.node.ts: Lazy load kafkajs
  • utils.ts: Lazy load logLevel and SchemaRegistry

Fixes Render deployment build error.

https://claude.ai/code/session_01W77KEXx3SkQzU8gvfNVpUj

Summary

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

The newly added Kafka and KafkaTrigger nodes were failing during the
build process when the metadata generation script tried to load them.
The issue was that kafkajs and @kafkajs/confluent-schema-registry were
being imported at the module level, which caused failures when loaded
in the VM context during metadata generation.

This fix makes all kafkajs-related imports lazy by using dynamic
imports (await import()) only when the node actually executes, allowing
the metadata generation to complete successfully.

Changes:
- Kafka.node.ts: Lazy load kafkajs and SchemaRegistry
- KafkaTrigger.node.ts: Lazy load kafkajs
- utils.ts: Lazy load logLevel and SchemaRegistry

Fixes Render deployment build error.

https://claude.ai/code/session_01W77KEXx3SkQzU8gvfNVpUj
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acb02b725d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const ssl = credentials.ssl as boolean;

const config: KafkaConfig = {
const config: any = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore KafkaConfig typing instead of any

This change downgrades config from KafkaConfig to any, which removes compile-time validation for Kafka client and SASL settings and allows malformed options to reach runtime failures in credential tests and execution paths. The same untyped pattern is repeated in this commit across the Kafka node files, and it conflicts with the package rule in packages/nodes-base/AGENTS.md (“Never use any type”); using type-only references (for example import('kafkajs').KafkaConfig) would keep lazy loading without losing safety.

Useful? React with 👍 / 👎.

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Feb 15, 2026
@n8n-assistant
Copy link
Contributor

n8n-assistant bot commented Feb 15, 2026

Hey @caloganathan,

Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request.

Before we can proceed, please ensure the following:
• Tests are included for any new functionality, logic changes or bug fixes.
• The PR aligns with our contribution guidelines.

Regarding new nodes:
We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently.

If your node integrates with an AI service that you own or represent, please email nodes@n8n.io and we will be happy to discuss the best approach.

About review timelines:
This PR has been added to our internal tracker as "GHC-6849". While we plan to review it, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins.

Thank you again for contributing to n8n.

@Joffcom
Copy link
Member

Joffcom commented Feb 15, 2026

Hey @caloganathan

The Kafka nodes are not new and our builds seem to be working, can you share what error you were seeing and how you were building?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants