apache / incubator-devlake

Apache DevLake is an open-source dev data platform to ingest, analyze, and visualize the fragmented data from DevOps tools, extracting insights for engineering excellence, developer experience, and community growth.
https://devlake.apache.org/
Apache License 2.0
2.6k stars 528 forks source link

[Bug][Customize] Create new field not working #8173

Open sstojak1 opened 3 weeks ago

sstojak1 commented 3 weeks ago

Search before asking

What happened

When attempting to create a new field with the Customize plugin, the request returns a 500 status code. Screenshots of the API key and error code are attached.

What do you expect to happen

New field to be created successfully.

How to reproduce

  1. Create a new API key through UI
  2. Run the following curl: curl --location 'https://my-devlake-endpoint/api/rest/plugins/customize/issues/fields' \ --header 'accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <my_api_key>' \ --data '{ "columnName": "x_test", "dataType": "varchar(255)", "displayName":"test" }'

Anything else

image image

Version

v1.0.2-beta3@7cf1a60

Are you willing to submit PR?

Code of Conduct

dosubot[bot] commented 3 weeks ago

The 500 status code indicates an internal server error, which can occur due to several reasons when creating a new field with the Customize plugin. Here are some potential causes and steps to diagnose the issue:

  1. Field Validation: Ensure that the columnName starts with "x" and matches the regular expression `^x[a-zA-Z0-9_]{0,50}$. ThedisplayNamemust not be empty, and thedataTypemust be one of the supported types:varchar(255),text,bigint,float,timestamp` [1].

  2. Database Operations: The error might occur during database operations such as creating the field or adding a column. Check if there are any database constraints or issues with the database connection that might be causing the error [2].

  3. Error Handling: The CreateField service method includes error handling that wraps errors with errors.Default.Wrap. If an unexpected error occurs during the execution of this method, it could result in a 500 status code [2].

  4. Middleware and Global Error Handling: The DevLake backend has middleware that handles errors globally. This could affect how errors are reported for the Customize plugin. Check the logs for any error messages or stack traces that might provide more details about the issue [3].

To further diagnose the issue, review the server logs for any specific error messages or stack traces that occur when the 500 error is returned. This information can help pinpoint the exact cause of the error.

To continue talking to Dosu, mention @dosu.