Kiwi-TCMS v8.4部署新环境后遇DataTables警告,本地运行正常
Hey there, let's figure out why you're hitting that DataTables error after deploying Kiwi-TCMS v8.4 to your non-local environment! The Requested unknown parameter 'plan_id' for row 0, column 0 message typically means there's a mismatch between what the frontend DataTables component expects from the backend and what's actually being sent—especially since everything works fine locally. Here are targeted steps to diagnose and fix this:
Inspect the backend API response
Open your browser's DevTools (F12), go to the Network tab, and refresh the page where the error occurs. Locate the API request that feeds data toresultsTable(it might look something like/api/test-executions/or a similar endpoint). Compare the JSON response from your deployment environment with the one from your local machine:- Does the deployment response include the
plan_idfield for every row? - Is the field name spelled correctly (e.g., no camelCase
planIdinstead of snake_caseplan_id)?
Ifplan_idis missing or misnamed in the deployment response, that's the root cause.
- Does the deployment response include the
Validate database migrations
Kiwi-TCMS relies on Django database migrations to keep table structures in sync. Double-check that you ranpython manage.py migratein your deployment environment during setup. If migrations were skipped, the database table associated with these records might lack theplan_idcolumn entirely. You can also directly inspect the database (e.g., usingpsqlfor PostgreSQL) to confirm the column exists in the relevant table (liketestruns_testexecution) and that data is populated.Compare environment configurations
Look for differences between your locallocal_settings.pyand the one in your deployment environment. Are there any flags or settings that alter how test execution data is fetched? For example, a feature toggle that's enabled locally but disabled in deployment might be excluding theplan_idfrom API responses. Also, ensure both environments are connecting to the correct database instances—if deployment uses a different DB with incomplete data, that could cause missingplan_idvalues.Check for missing or incomplete data
The error mentions "row 0", so find the corresponding record in your deployment database. Does this record actually have a validplan_idassociated with it? It's possible that when you migrated data to the deployment environment, some test execution records weren't linked to test plans properly, leading to missingplan_idvalues. Compare this record with the equivalent one in your local database to spot discrepancies.Verify frontend code consistency
While less likely (since local works), confirm that the frontend code deployed matches your local version. Check the DataTables initialization code forresultsTable—does it explicitly referenceplan_idas the data source for column 0? A typo or outdated code in deployment could cause the component to look for a field that doesn't exist.
If you've gone through these steps and still can't pinpoint the issue, sharing a snippet of the API response (redacted for privacy) or details about your deployment setup (e.g., containerized vs. bare metal, database type) would help narrow things down further.
内容的提问来源于stack exchange,提问作者nanika21

