Description:
When creating a new field (specifically a “Many to One” association in my case) or updating field associations, the application crashes with a TypeError: fields is not iterable. This appears to happen within the @nocobase/plugin-acl plugin when it tries to automatically update permissions for existing roles.
Environment:
• NocoBase Version: 2.0.0-beta.1-full
• Database: PostgreSQL 16
• Deployment: Docker
Steps to Reproduce:
• Have a NocoBase instance with existing roles/permissions configured.
• Attempt to add a new “Many to One” relationship field between two collections (e.g., account_brand → account).
• The request fails with a 500 error.
Root Cause Analysis:
The issue is located in node_modules/@nocobase/plugin-acl/dist/server/server.js within the fields.afterCreate listener.
The code fetches resourceActions and attempts to spread the fields property into a new array. However, if the retrieved fields value is null or undefined (which seems possible for certain ACL configurations), the spread operator fails.