Open msucevan opened 8 months ago
Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)
Yesterday I've created a new fresh project and deployed to laravel Vapor and it works fine.
However, I have the same problem all around my project. In local is working perfectly without any kind of issue, when I'm my staging or production environment I occur in this problem.
Is really strange because the payload looks good.
/**
* Format available rules.
*
* @return array<array-key, mixed>
*
* @phpstan-return array<string, TFieldValidationRules>
*/
protected function formatRules()
{
$request = app(NovaRequest::class);
if ($request->method() === 'GET') {
return [];
}
return collect($request->{$this->validationKey()})
->map(function ($item) {
return $this->repeatables->findByKey($item['type']); // Is failing here
})
->flatMap(function (Repeatable $repeatable, $index) use ($request) {
return FieldCollection::make($repeatable->fields($request))
->mapWithKeys(function (Field $field) use ($index) {
return ["{$this->validationKey()}.{$index}.fields.{$field->attribute}" => $field->rules];
});
})
->all();
}
This is just an example, I have over 10 Repeater fields spread around the project and everyone is failing for the same issue.
After a few days under investigation, I realized that the problem is caused by Laravel-octane, but I have no idea why.
I will publish a reproducible repository soon @crynobone
Please @crynobone you can fork the repo: https://github.com/msucevan/nova-issue
I will write an issue also in octane, maybe is more related with octane
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@crynobone any updates here? Should I provide more info?
@msucevan I've run into a very similar issue with a nova library. Only occurs when running in the vapor environment with octane on.
https://github.com/ebess/advanced-nova-media-library/issues/369
@msucevan I've run into a very similar issue with a nova library. Only occurs when running in the vapor environment with octane on.
I'm not using this package. So you mean that removing this packages it works also with octane? Because in a fresh install is not working.
Seems to be related to https://github.com/laravel/nova-issues/issues/5339#issuecomment-1437511009
Is everyone on the same free Vapor setup?
@crynobone I tested using a custom domain and I have a validation error on an existing resource that don't occur when I'm not using Octane.
name: name
price: 110.0000
finishing_price:
program_price:
setup_price:
factor: 1.2500
k_factors[0][type]: k-factor
k_factors[0][fields][r_t]: 1
k_factors[0][fields][k]: 2
k_factors[1][type]: k-factor
k_factors[1][fields][r_t]: 2.5
k_factors[1][fields][k]: 3.5
k_factors[2][type]: k-factor
k_factors[2][fields][r_t]: 2.5
k_factors[2][fields][k]: 2.5
"message": "The k factors.0.fields.r t field is required. (and 1 more error)",
If I send a resource where k_factors are empty or null I receive the error posted:
"message": "Undefined array key "type"",
and this is the payload:
price: 110.0000
finishing_price:
program_price:
setup_price:
factor: 1.2500
k_factors[0][type]: k-factor
k_factors[0][fields][r_t]: 1
k_factors[0][fields][k]: 2```
There's no r_t
or k
field based on the example repository
Let's say that this answer is pretty boring and frustrating, since doesn't change which the field name is. Of course I will not spend time and money on this issue in a fresh repository (I already give you all the information and a fresh project). I tested the custom domains on my project, the issue is reproducible in the same way as I described in a fresh install on the code that I give you. If you just seed the data inside the fields we will have the same "validation" issue, come on........
Description:
All the repeater fields are not working in Laravel Vapor.
Detailed steps to reproduce the issue on a fresh Nova installation:
Here is the implementation on one of them and the relative error:
This is just an example, I have over 10 Repeater fields spread around the project and everyone is failing for the same issue.