You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: regenerate-iam fails due to audit_log column name mismatch #30
The nemar admin regenerate-iam command fails for all users with the error:
Failed to create IAM credentials
Root Cause
In backend/src/routes/admin.ts:571-579, the audit_log INSERT statement uses incorrect column names:
Uses: entity_type and entity_id
Should use: resource_type and resource_id
The actual error from the API:
{
"error": "Failed to create IAM credentials",
"details": "D1_ERROR: table audit_log has no column named entity_type: SQLITE_ERROR"
}
Affected Code
// Line 571-579 in backend/src/routes/admin.tsawaitdb.prepare("INSERT INTO audit_log (user_id, action, entity_type, entity_id, details) VALUES (?, ?, ?, ?, ?)").bind(...).run();
Compare with the correct usage in the approve endpoint (line 228-245):
awaitdb.prepare(`INSERT INTO audit_log (user_id, action, resource_type, resource_id, details) VALUES (...)`)
Steps to Reproduce
Run nemar admin regenerate-iam <username>
Confirm the action
Observe the failure
Additional Issue
The regenerate-iam command also does not grant admins access to the whole bucket. Admin users should have bucket-wide access, not just access to their own datasets.
Fix
Change entity_type to resource_type and entity_id to resource_id in the audit_log INSERT
For admin users, generate a policy with full bucket access instead of dataset-specific prefixes
Activity
fix: regenerate-iam audit_log column names and admin bucket access
fix: regenerate-iam audit_log column names and admin bucket access (#31)
ADR 0137: amendment for neuroschema 0.6.0 review (#2352)