n8n v2.0 重大变更#
¥n8n v2.0 breaking changes
n8n v2.0 即将发布。本文档重点介绍了重要的重大变更以及你应采取的措施,以做好过渡准备。这些更新提高了安全性,简化了配置,并移除了旧版功能。
¥n8n v2.0 will be released soon. This document highlights important breaking changes and actions you should take to prepare for the transition. These updates improve security, simplify configuration, and remove legacy features.
n8n 2.0 的发布延续了 n8n 致力于提供安全、可靠且可用于生产环境的自动化平台的承诺。此主要版本包含重要的安全增强功能和已弃用功能的清理。
¥The release of n8n 2.0 continues n8n's commitment to providing a secure, reliable, and production-ready automation platform. This major version includes important security enhancements and cleanup of deprecated features.
行为变更#
¥Behavior changes
子工作流从等待状态(等待 webhook、表单、HITL 等)恢复时,返回预期的子工作流数据#
¥Return expected sub-workflow data when the sub-workflow resumes from waiting (waiting for webhook, forms, HITL, etc.)
以前,当一个执行(父级)调用一个包含导致子执行进入等待状态的节点的子执行(子级)时,如果父级执行被设置为等待子执行完成,则父级执行会收到错误的响应。结果。
¥Previously, when an execution (parent) called a sub-execution (child) that contained a node that causes the sub-execution to enter the waiting state and the parent-execution is set up to wait for the sub-execution's completion, the parent-execution would receive incorrect results.
例如,如果子执行包含超时时间超过 60 秒的 Wait 节点、Webhook 调用、表单提交或人工干预节点(例如 Slack 节点),则会进入等待状态。
¥Entering the waiting state would happen for example if the sub-execution contains a Wait node with a timeout higher than 60 seconds or a webhook call or a form submission, or a human-in-the-loop node, like the slack node.
父工作流:
¥Parent-Workflow:
子工作流:
¥Sub-Workflow:
v1:父执行将子执行的输入作为其输出:
¥v1: The parent-execution reproduces the sub-execution's input as its output.:
v2:父执行接收子执行的结果:
¥v2: The parent execution receives the result of the child execution:
这使得在子工作流中使用人机交互节点,并在父工作流中使用结果(例如,批准或拒绝操作)。
¥This allows using human-in-the-loop nodes in the sub-workflow and use the results (for example approving or declining an action) in the parent-workflow.
迁移路径:检查所有调用子工作流并期望接收子工作流输入的工作流。更新以下工作流以处理新的行为,即父工作流接收子工作流的输出。
¥Migration path: Review any workflows that call sub-workflows and expect to receive the input to the sub-workflow. Update these workflows to handle the new behavior, where the parent-workflow receives the output from the end of the child-workflow instead.
移除已停用服务的节点#
¥Removed nodes for retired services
以下节点已被移除,因为它们连接的外部服务已不再可用:
¥The following nodes have been removed because the external services they connect to are no longer available:
- 自发节点
¥Spontit node
- crowd.dev 节点
¥crowd.dev node
- Kitemaker 节点
¥Kitemaker node
- Automizy 节点
¥Automizy node
迁移路径:如果你的工作流使用了任何这些节点,请更新或删除这些工作流以避免错误。
¥Migration path: If your workflows use any of these nodes, update or remove those workflows to avoid errors.
安全#
¥Security
默认情况下阻止从代码节点访问环境变量#
¥Block environment variable access from Code Node by default
为了提高安全性,n8n 默认会阻止从代码节点访问环境变量。N8N_BLOCK_ENV_ACCESS_IN_NODE 的默认值现在设置为 true。
¥To improve security, n8n will block access to environment variables from the Code node by default. The default value for N8N_BLOCK_ENV_ACCESS_IN_NODE is now set to true.
迁移路径:如果你的工作流需要在代码节点中访问环境变量,请在环境配置中设置 N8N_BLOCK_ENV_ACCESS_IN_NODE=false。对于敏感数据,请使用凭据或其他安全方法,而不是环境变量。
¥Migration path: If your workflows require access to environment variables in Code nodes, set N8N_BLOCK_ENV_ACCESS_IN_NODE=false in your environment configuration. For sensitive data, use credentials or other secure methods instead of environment variables.
强制设置文件权限#
¥Enforce settings file permissions
n8n 将要求对配置文件设置严格的文件权限,以提高安全性。默认情况下,配置文件必须使用 0600 权限,这意味着只有文件所有者才能读取和写入它们。这种方法类似于 SSH 保护私钥的方式。
¥n8n will require strict file permissions for configuration files to improve security. By default, configuration files must use 0600 permissions, which means only the file owner can read and write them. This approach is similar to how SSH protects private keys.
迁移路径:要在 v2.0 版本之前测试此行为,请设置 N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true。如果你的环境不支持文件权限(例如,在 Windows 上),请将 N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false 设置为禁用此要求。
¥Migration path: To test this behavior before v2.0, set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true. If your environment doesn't support file permissions (for example, on Windows), set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false to disable this requirement.
默认启用任务运行器#
¥Enable task runners by default
n8n 默认启用 任务运行器 节点,以提高安全性和隔离性。所有代码节点执行将在任务运行器上运行。
¥n8n will enable task runners by default to improve security and isolation. All Code node executions will run on task runners.
迁移路径:在升级到 v2.0 之前,请将 N8N_RUNNERS_ENABLED 设置为 true 以测试此行为。确保你的基础架构满足运行任务运行器的要求。为了增强安全性,请考虑使用 外部模式。
¥Migration path: Before upgrading to v2.0, set N8N_RUNNERS_ENABLED=true to test this behavior. Make sure your infrastructure meets the requirements for running task runners. For additional security, consider using external mode.
从 n8nio/n8n Docker 镜像中移除任务运行器#
¥Remove task runner from n8nio/n8n docker image
从 v2.0 版本开始,主 n8nio/n8n Docker 镜像将不再包含外部模式下的任务运行器。要以外部模式运行任务运行器,必须使用单独的 n8nio/runners Docker 镜像。
¥Starting with v2.0, the main n8nio/n8n Docker image will no longer include the task runner for external mode. You must use the separate n8nio/runners Docker image to run task runners in external mode.
迁移路径:如果你在 Docker 中使用外部模式运行任务运行器,请更新你的设置以使用 n8nio/runners 镜像而不是 n8nio/n8n。
¥Migration path: If you run task runners in Docker with external mode, update your setup to use the n8nio/runners image instead of n8nio/n8n.
移除基于 Pyodide 的 Python 代码节点和工具#
¥Remove Pyodide-based Python Code node and tool
n8n 将移除基于 Pyodide 的 Python 代码节点和工具,并将其替换为使用原生 Python 的 基于任务运行器 实现,以提高安全性和性能。从 v2.0 版本开始,你只能在 外部模式 任务运行器和原生 Python 工具中使用 Python 代码节点。
¥n8n will remove the Pyodide-based Python Code node and tool and replace them with a task runner-based implementation that uses native Python for better security and performance. Starting in v2.0, you can only use Python Code nodes with task runners in external mode and native Python tools.
原生 Python 代码节点不支持内置变量,例如 _input 或点访问表示法,这些在基于 Pyodide 的版本中可用。详情请参阅 代码节点文档。
¥The native Python Code node doesn't support built-in variables like _input or dot access notation, which were available in the Pyodide-based version. For details, see the Code node documentation.
原生 Python 工具支持 _query 作为 AI 代理调用该工具时传递给它的输入字符串。
¥The native Python tool supports _query for the input string that the AI Agent passes to the tool when it calls it.
迁移路径:要继续在代码节点中使用 Python,请在外部模式下设置任务运行器,并检查现有 Python 代码节点和工具的兼容性。
¥Migration path: To continue using Python in Code nodes, set up task runners in external mode and review your existing Python Code nodes and tools for compatibility.
默认禁用 ExecuteCommand 和 LocalFileTrigger 节点#
¥Disable ExecuteCommand and LocalFileTrigger nodes by default
n8n 默认禁用 ExecuteCommand 和 LocalFileTrigger 节点,因为它们存在安全风险。这些节点允许用户运行任意命令并访问文件系统。
¥n8n will disable the ExecuteCommand and LocalFileTrigger nodes by default because they pose security risks. These nodes allow users to run arbitrary commands and access the file system.
迁移路径:如果你需要使用这些节点,请通过更新 NODES_EXCLUDE 环境变量,将它们从 n8n 配置中的禁用节点列表中移除。例如,将 NODES_EXCLUDE="[]" 设置为启用所有节点,或仅删除你需要的特定节点。
¥Migration path: If you need to use these nodes, remove them from the disabled nodes list in your n8n configuration by updating the NODES_EXCLUDE environment variable. For example, set NODES_EXCLUDE="[]" to enable all nodes, or remove only the specific nodes you need.
要求在 OAuth 回调中进行身份验证默认 URL#
¥Require authentication on OAuth callback URLs by default
n8n 将默认要求对 OAuth 回调端点进行身份验证。N8N_SKIP_AUTH_ON_OAUTH_CALLBACK 的默认值将从 true(无需身份验证)更改为 false(需要身份验证)。
¥n8n will require authentication for OAuth callback endpoints by default. The default value for N8N_SKIP_AUTH_ON_OAUTH_CALLBACK will change from true (no authentication required) to false (authentication required).
迁移路径:在升级到 v2.0 之前,请设置 N8N_SKIP_AUTH_ON_OAUTH_CALLBACK=false 并测试你的 OAuth 集成,以确保它们在启用身份验证的情况下正常工作。
¥Migration path: Before upgrading to v2.0, set N8N_SKIP_AUTH_ON_OAUTH_CALLBACK=false and test your OAuth integrations to ensure they work with authentication enabled.
设置 N8N_RESTRICT_FILE_ACCESS_TO 的默认值#
¥Set default value for N8N_RESTRICT_FILE_ACCESS_TO
n8n 将为 N8N_RESTRICT_FILE_ACCESS_TO 设置一个默认值,以控制文件操作的执行位置。这会影响 ReadWriteFile 和 ReadBinaryFiles 节点。默认情况下,这些节点只能访问 ~/.n8n-files 目录中的文件。
¥n8n will set a default value for N8N_RESTRICT_FILE_ACCESS_TO to control where file operations can occur. This affects the ReadWriteFile and ReadBinaryFiles nodes. By default, these nodes can only access files in the ~/.n8n-files directory.
迁移路径:检查使用文件节点的工作流,并确保它们仅访问允许目录中的文件。如果你需要允许访问其他目录,请将 N8N_RESTRICT_FILE_ACCESS_TO 环境变量设置为你所需的路径。
¥Migration path: Review your workflows that use file nodes and make sure they only access files in the allowed directory. If you need to allow access to other directories, set the N8N_RESTRICT_FILE_ACCESS_TO environment variable to your desired path.
将 N8N_GIT_NODE_DISABLE_BARE_REPOS 的默认值更改为 true#
¥Change the default value of N8N_GIT_NODE_DISABLE_BARE_REPOS to true
默认情况下,出于安全考虑,Git 节点现在会阻止裸仓库。N8N_GIT_NODE_DISABLE_BARE_REPOS 的默认值已设置为 true,这意味着除非你更改此设置,否则裸存储库将被禁用。
¥By default, the Git node will now block bare repositories for security reasons. The default value for N8N_GIT_NODE_DISABLE_BARE_REPOS is set to true, which means bare repositories are disabled unless you change this setting.
迁移路径:如果你的工作流需要使用裸存储库,请在环境配置中设置 N8N_GIT_NODE_DISABLE_BARE_REPOS=false 以启用它们。
¥Migration path: If your workflows need to use bare repositories, set N8N_GIT_NODE_DISABLE_BARE_REPOS=false in your environment configuration to enable them.
数据#
¥Data
放弃 MySQL/MariaDB 支持#
¥Drop MySQL/MariaDB support
n8n 将不再支持 MySQL 和 MariaDB 作为存储后端。此功能在 v1.0 中已弃用。为了获得最佳兼容性和长期支持,请使用 PostgreSQL。MySQL 节点将继续像以前一样得到支持。
¥n8n will no longer support MySQL and MariaDB as storage backends. This support was deprecated in v1.0. For best compatibility and long-term support, use PostgreSQL. MySQL node will continue to be supported as before.
迁移路径:在升级到 v2.0 之前,请使用数据库迁移工具将你的数据从 MySQL 或 MariaDB 迁移到 PostgreSQL 或 SQLite。
¥Migration path: Before upgrading to v2.0, use the database migration tool to move your data from MySQL or MariaDB to PostgreSQL or SQLite.
移除 SQLite 旧版驱动程序#
¥Remove SQLite legacy driver
n8n 将移除旧版 SQLite 驱动程序,因为其可靠性存在问题。连接池驱动程序将成为默认且唯一的 SQLite 驱动程序。连接池驱动程序使用 WAL 模式、单个写入连接和读取连接池。我们的基准测试表明,速度最多可提升 10 倍。
¥n8n will remove the legacy SQLite driver due to reliability issues. The pooling driver will become the default and only SQLite driver. The pooling driver uses WAL mode, a single write connection, and a pool of read connections. Our benchmarks show it can be up to 10 times faster.
迁移路径:sqlite-pooled 驱动程序将自动成为默认驱动程序。你现在可以通过将 DB_SQLITE_POOL_SIZE 设置为大于 0 的值来启用池化。默认池大小将设置为 2。
¥Migration path: The sqlite-pooled driver will become the default automatically. You can enable pooling now by setting DB_SQLITE_POOL_SIZE to a value greater than 0. The default pool size will be set to 2.
移除内存二进制数据模式#
¥Remove in-memory binary data mode
n8n 将移除 N8N_DEFAULT_BINARY_DATA_MODE 的 default 模式,该模式会在执行期间将执行二进制数据保存在内存中。为了提升性能和稳定性,从 v2 版本开始,将提供以下选项:
¥n8n will remove the default mode for N8N_DEFAULT_BINARY_DATA_MODE, which keeps execution binary data in memory during execution. For better performance and stability the following options will be available starting from v2:
filesystem:二进制数据存储在文件系统中。常规模式下的默认选项。
¥filesystem: Binary data is stored in the filesystem. Default option in regular mode.
database:二进制数据存储在数据库中。队列模式下的默认选项。
¥database: Binary data is stored in the database. Default option in queue mode.
s3:二进制数据存储在与 S3 兼容的存储中。
¥s3: Binary data is stored in S3 compatible store.
N8N_AVAILABLE_BINARY_DATA_MODES 设置也将被移除,因此模式现在仅由 N8N_DEFAULT_BINARY_DATA_MODE 决定。
¥The N8N_AVAILABLE_BINARY_DATA_MODES setting will also be removed, so the mode is now determined only by N8N_DEFAULT_BINARY_DATA_MODE.
迁移路径:将根据配置自动使用文件系统或数据库模式。确保你的 n8n 实例有足够的磁盘空间来存储二进制数据。详情请参阅 二进制数据配置。
¥Migration path: Filesystem or database mode will be used automatically based on configuration. Make sure your n8n instance has enough disk space to store binary data. For details, see the binary data configuration.
配置和环境#
¥Configuration & Environment
升级 dotenv#
¥Upgrade dotenv
n8n 使用 dotenv 库从 .env 文件加载环境配置。该库将从 8.6.0 版本升级到最新版本,这可能会改变 .env 文件的解析方式。密钥重大变更包括:
¥n8n loads environment configuration from a .env file using the dotenv library. The library will be upgraded from version 8.6.0 to the latest version, which may change how .env files are parsed. Key breaking changes include:
- 反引号支持 (#615):如果你的值包含反引号,请将其用单引号或双引号括起来。
¥Backtick support (#615): If your values contain backticks, wrap them in single or double quotes.
- 多行支持现在你可以使用多行值。
¥Multiline support: You can now use multiline values.
#标记注释的开始:以 # 开头的行将被视为注释。
¥# marks the beginning of a comment: Lines starting with # are treated as comments.
迁移路径:检查 dotenv 更新日志 文件并更新你的 .env 文件,以确保与新版本兼容。
¥Migration path: Review the dotenv changelog and update your .env file to ensure compatibility with the new version.
移除 n8n --tunnel 选项#
¥Remove n8n --tunnel option
n8n --tunnel 命令行选项将在 v2.0 版本中移除。
¥The n8n --tunnel command-line option will be removed in v2.0.
迁移路径:如果你当前使用 --tunnel 选项进行开发或测试,请切换到其他隧道解决方案,例如 ngrok、localtunnel 或 Cloudflare Tunnel。更新你的工作流和文档以反映此更改。
¥Migration path: If you currently use the --tunnel option for development or testing, switch to an alternative tunneling solution such as ngrok, localtunnel, or Cloudflare Tunnel. Update your workflow and documentation to reflect this change.
移除 QUEUE_WORKER_MAX_STALLED_COUNT#
¥Remove QUEUE_WORKER_MAX_STALLED_COUNT
由于 QUEUE_WORKER_MAX_STALLED_COUNT 环境变量和 Bull 重试机制经常造成混淆且运行不稳定,因此将被移除。
¥The QUEUE_WORKER_MAX_STALLED_COUNT environment variable and the Bull retry mechanism for stalled jobs will be removed because they often caused confusion and didn't work reliably.
迁移路径:从配置中删除此环境变量。升级后,n8n 将不再自动重试停滞的作业。如果你需要处理停滞的作业,请考虑实现你自己的重试逻辑或监控机制。
¥Migration path: Delete this environment variable from your configuration. After upgrading, n8n will no longer automatically retry stalled jobs. If you need to handle stalled jobs, consider implementing your own retry logic or monitoring.
CLI 和工作流#
¥CLI & Workflow
替换 CLI 命令 update:workflow#
¥Replace CLI command update:workflow
update:workflow CLI 命令将被弃用,并由两个新命令替代,以提供类似的功能和更高的清晰度:
¥The update:workflow CLI command will be deprecated and replaced by two new commands to deliver similar functionality and more clarity:
publish:workflow使用参数id和versionId(可选)
¥publish:workflow with parameters id and versionId (optional)
-
为了防止在生产环境中意外激活工作流,
--all参数将被移除。¥The
--allparameter will be removed to prevent accidental activation of workflows in production environments -
unpublish:workflow使用参数id和all
¥unpublish:workflow with parameters id and all
迁移路径:使用新的 publish:workflow 命令按 ID 单独激活工作流,并可选择指定版本。要停用,请使用新的 unpublish:workflow 命令。这提供了对工作流激活状态更清晰、更易于控制的功能。
¥Migration path: Use the new publish:workflow command to activate workflows individually by ID, optionally specifying a version. For deactivation, use the new unpublish:workflow command. This provides better clarity and control over workflow activation states.
外部钩子#
¥External Hooks
已弃用的前端工作流钩子#
¥Deprecated frontend workflow hooks
钩子 workflow.activeChange 和 workflow.activeChangeCurrent 将被弃用。这些将被新的钩子 workflow.published 取代。当发布任何版本的工作流时,将触发新的钩子。
¥The hooks workflow.activeChange and workflow.activeChangeCurrent will be deprecated. These will be replaced by a new hook workflow.published. The new hook will be triggered when any version of a workflow is published.
迁移路径:更新代码,使用新的 workflow.published 钩子代替 workflow.activeChange 和 workflow.activeChangeCurrent。此钩子提供更一致的行为,并将在每次发布工作流版本时触发。
¥Migration path: Update your code to use the new workflow.published hook instead of workflow.activeChange and workflow.activeChangeCurrent. This hook provides more consistent behavior and will be triggered whenever a workflow version is published.
发布渠道#
¥Release channels
n8n 已将发布通道分别从 latest 和 next 重命名为 stable 和 beta。
¥n8n has renamed the release channels from latest and next to stable and beta, respectively.
stable 标签表示最新的稳定版本,beta 标签表示最新的实验版本。这些标签在 npm 和 Docker Hub 上均可用。目前,n8n 将继续使用 latest 和 next 作为版本号。这些标签将在未来的主版本中移除。
¥The stable tag designates the latest stable release, and the beta tag designates the latest experimental release. These tags are available on both npm and Docker Hub. For now, n8n will continue to tag releases as latest and next. These tags will be removed in a future major version.
建议:将你的 n8n 版本锁定到特定版本号,例如 2.0.0。
¥Recommendation: Pin your n8n version to a specific version number, for example, 2.0.0.
举报问题#
¥Reporting issues
如果你在更新到 n8n 2.0 时遇到任何问题,请访问 forum 社区寻求帮助和支持。
¥If you run into any problems while updating to n8n 2.0, visit the community forum for help and support.



