Troubleshooting ThorAPI
This document provides guidance on troubleshooting common issues encountered when using ThorAPI.
Common Issues
1. Code Generation Errors
- Problem: ThorAPI fails to generate code, or the generated code contains errors.
- Possible Causes:
- Invalid OpenAPI specification: The OpenAPI specification may contain syntax errors or invalid data types.
- Template errors: The code generation templates may contain errors or be incompatible with the OpenAPI specification.
- Dependency conflicts: There may be conflicts between the dependencies used by ThorAPI and the dependencies in your project.
- Solutions:
- Validate your OpenAPI specification using a tool like Swagger Editor.
- Review the ThorAPI logs for error messages and stack traces.
- Ensure that your project dependencies are compatible with ThorAPI.
- Try using a different code generation template.
2. Database Connection Errors
- Problem: ThorAPI fails to connect to the database, or the generated code cannot access the database.
- Possible Causes:
- Incorrect database credentials: The database username, password, or connection URL may be incorrect.
- Database server not running: The database server may not be running or may be inaccessible.
- Firewall issues: A firewall may be blocking access to the database server.
- Solutions:
- Verify that your database credentials are correct.
- Ensure that the database server is running and accessible.
- Check your firewall settings to ensure that access to the database server is allowed.
3. SecureField Encryption Errors
- Problem: SecureField encryption fails, or the generated code cannot decrypt SecureField values.
- Possible Causes:
- Incorrect THORAPI_SECRET_KEY: The THORAPI_SECRET_KEY environment variable may be missing or incorrect.
- Key rotation issues: There may be issues with key rotation or key management.
- Data corruption: The encrypted data may be corrupted.
- Solutions:
- Verify that the THORAPI_SECRET_KEY environment variable is set correctly.
- Ensure that key rotation is configured correctly.
- Check the database for data corruption.
Debugging Tips
- Review the ThorAPI logs: The ThorAPI logs contain valuable information about the code generation process, including error messages, warnings, and stack traces.
- Use a debugger: Use a debugger to step through the ThorAPI code and identify the source of the problem.
- Simplify your OpenAPI specification: Try simplifying your OpenAPI specification to isolate the issue.
- Test with a minimal example: Create a minimal example that reproduces the problem and use it to test different solutions.