-
Notifications
You must be signed in to change notification settings - Fork 34
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
Undefined array key "type" on Repeater Field when using Octane in Vapor #6229
Comments
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. |
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 #5339 (comment) 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.
If I send a resource where k_factors are empty or null I receive the error posted: and this is the payload:
|
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.
The text was updated successfully, but these errors were encountered: