Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API: ReflectionException "Class 'Webkul\Attribute\Http\Requests\AttributeForm' does not exist" in Krayin CRM v2.0.1 #1595

Open
fitulka opened this issue Sep 10, 2024 · 1 comment

Comments

@fitulka
Copy link

fitulka commented Sep 10, 2024

Description:

After integrating the REST API package (commit 121c25b) with Krayin CRM v2.0.1, I encountered an error when attempting to create contacts via API endpoints. The issue specifically occurs when making POST requests to the following endpoints:

/api/v1/contacts/organizations
/api/v1/contacts/persons

The system throws a ReflectionException stating that the class Webkul\Attribute\Http\Requests\AttributeForm does not exist.

Request Example (for /api/v1/contacts/persons):

curl -X 'POST'
'https://crm.example.com/api/v1/contacts/persons'
-H 'accept: application/json'
-H 'Authorization: Bearer 1|HznFUL2xut1UpxjGcQM8cDW3NjJiRgfjRDUYrvJYe48fb0a2'
-H 'Content-Type: application/json'
-H 'X-CSRF-TOKEN: '
-d '{
"name": "John Doe",
"emails": [
{
"value": "john.doe@mail.com",
"label": "work"
}
],
"contact_numbers": [
{
"value": "09315981404",
"label": "work"
}
],
"organization_id": 1,
"entity_type": "persons"
}'

Response:

{
"message": "Class 'Webkul\\Attribute\\Http\\Requests\\AttributeForm' does not exist",
"exception": "ReflectionException",
"file": "/var/www/htdocs/example.com/crm/vendor/laravel/framework/src/Illuminate/Routing/ResolvesRouteDependencies.php",
"line": 81,
"trace": [...]
}

Steps to Reproduce:

  1. Install Krayin CRM v2.0.1.
  2. Install the latest commit (121c25b) of the REST API package.
  3. Try creating a new contact via the /api/v1/contacts/persons or /api/v1/contacts/organizations endpoint.

The error occurs during the request, and the contact is not created.

Expected Behavior:

The API should correctly handle the request and create the contact as expected.

Environment:

Krayin CRM v2.0.1
REST API Package Commit 121c25b
PHP 8.2.x

Additional Context:

It seems the Webkul\Attribute\Http\Requests\AttributeForm class might be missing or not properly registered within the application. Since the REST API relies on core functionality in Krayin CRM, it's unclear if this issue is related more to the CRM codebase or the API package.

We are currently evaluating whether to stay on version 2.0.1 or revert to 1.3.0 to ensure full API functionality.

Could you provide clarification or guidance on this issue?

@suraj-webkul
Copy link
Collaborator

suraj-webkul commented Sep 10, 2024

This issue has been fixed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants