Closed vesper8 closed 3 years ago
@vesper8 to confirm, v3.12.1
introduce few changes to fixes action usage on Lens but it require some update to the published js. Have you run artisan nova:publish
.
Also would be nice if you can share reproducing code, thank you.
@crynobone I'm setup so that every time I run composer install/update it auto-publishes so yes nova:publish
has been run
Really don't think this is a js/front-end issue
Tried reproducing the issue on a fresh Nova Install, unable to reproduce the issue.
https://github.com/nova-issues/issue-2947/commit/72bd086f72b44aecd341602f4a741b23a4a7d927
I also faced the same error on my existing project which I can't reproduce on a brand new project. But I found something. In my existing project, lens-specific actions with onlyOnTableRow()
method on them, use the following URL:
http://localhost:8000/nova-api/users/action?action=....
But on the new project actions in the same condition are using the following URL:
http://localhost:8001/nova-api/users/lens/user-lens/action?action=....
For sure, lens-specific actions can't be found among user's actions and it should respond 404. But, the question is why it tries to find them there? I also recreated action in my existing project and only copy-pasted fields and handle logic and faced the same result (404).
@crynobone Do you have any idea how can I debug this?
It worth mentioning I'm using v3.14.0
of laravel/nova
and v7.29.2
of laravel/framework
.
There multiple fixes that been push between 3.15 to 3.17, you should update the code the latest version.
@crynobone I've upgraded to the latest version, but I'm still facing the same issue.
After the upgrade, I've created a new Nova resource on my existing model, a new lens, and a new action to be used only in the lens and with onlyOnTableRow()
on it. I still get 404. I don't understand what's wrong and why it should use a wrong URL?
create a new issue detailing where exactly is the issue, with code example. There nothing to follow right now because I can't reproduce the issue on described above and there not enough info from you to work on.
I don't understand what's wrong and why it should use a wrong URL?
http://localhost:8001/nova-api/users/lens/user-lens/action?action=....
This is the correct URL, not the old one. Again as I said we done multiple fixes on Lens.
@crynobone I like to do so, but I can't reproduce it on a new project too. It's only on my existing project which I can't share because of my company's policy.
In my existing project, if I try to execute a lens-specific action from the table row, it uses the wrong URL (like it's trying to locate the action among the resource's actions):
http://localhost:8000/nova-api/users/action?action=....
So it errors 404.
I don't understand what's wrong and why it should use a wrong URL?
http://localhost:8001/nova-api/users/lens/user-lens/action?action=....
This is the correct URL, not the old one. Again as I said we done multiple fixes on Lens.
IKR, but I don't know why nova uses the wrong one???
Tested the code again and everything still working.
In my existing project, if I try to execute a lens-specific action from the table row, it uses the wrong URL (like it's trying to locate the action among the resource's actions):
You told me you're using 3.14.0
, this is an old version and doesn't have the updated code. Please upgrade to the latest version.
Tested the code again and everything still working.
In my existing project, if I try to execute a lens-specific action from the table row, it uses the wrong URL (like it's trying to locate the action among the resource's actions):
You told me you're using
3.14.0
, this is an old version and doesn't have the updated code. Please upgrade to the latest version.
I did:
@crynobone I've upgraded to the latest version, but I'm still facing the same issue.
I ran composer update
.
Have you run php artisan nova:publish
?
Have you run
php artisan nova:publish
?
I have a post-update script that does that automatically, However, I reran it. Still have the issue. :(
You need to provide reproducing code, otherwise there nothing I can help out right now.
I removed vendor
and composer.lock
and ran composer install
along with clearing all caches and dump-autoload. I still have the issue.
I think I'm going to fix it by not using onlyOnTableRow()
. Thanks for your time @crynobone.
I looked at the Nova's source and I found the following in the HandleActions.js
:
Nova.request({
method: 'post',
url: this.endpoint || `/nova-api/${this.resourceName}/action`,
params: this.actionRequestQueryString,
data: this.actionFormData(),
})
based on my observations, I think this.endpoint
is null so it fallback the other value. However, despite having yarn watch
command running (I also copied webpack.mix.js.dist
to webpack.mix.js
), I can't get anything when I place console.log()
in the source.
@crynobone I found something that might help. I removed vendor
directory and composer.lock
again and ran composer update
, followed by these commands:
> cd vendor/laravel/nova
> npm i
> mv webpack.mix.js.dist webpack.mix.js
> npm run dev
> cd -
> php artisan nova:publish
Then I tried to run my action again. I've seen the following in the console:
[Vue warn]: Property or method "actionsEndpoint" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
found in
---> <InlineActionSelector> at resources/js/components/Index/InlineActionSelector.vue
<ResourceTableRow>
<Draggable>
<ResourceTable>
<LoadingView> at resources/js/components/LoadingView.vue
<Card> at resources/js/components/Card.vue
<LoadingView> at resources/js/components/LoadingView.vue
<Lens> at resources/js/views/Lens.vue
<Root>
@TheSETJ vendor.js?id=0a6845b...
is not the latest file.
For Laravel Nova v3.17.0 you should be getting the following:
{
"/app.js": "/app.js?id=6186bc59b781c6a7e370",
"/app.css": "/app.css?id=40717efbdd839ce5aad5",
"/vendor.js": "/vendor.js?id=3810bf2033e3670b2acc",
"/manifest.js": "/manifest.js?id=2d315777967b6001bcf1"
}
@crynobone Well, what can I do more than removing the vendor
directory and clearing all caches to achieve that? Am I missing something?
Based on the error that's related to https://github.com/laravel/nova/pull/1006 which was introduce in v3.12.1
.
Still not enough information to replicate the issue.
You can try looking at https://github.com/laravel/nova-docs/pull/297 just in case there anything useful.
This is my mix-manifest.json
now:
{
"/app.js": "/app.js?id=6186bc59b781c6a7e370",
"/app.css": "/app.css?id=40717efbdd839ce5aad5",
"/vendor.js": "/vendor.js?id=3810bf2033e3670b2acc",
"/manifest.js": "/manifest.js?id=2d315777967b6001bcf1"
}
I created a new resource on top of one of an existing model, a new lens, and new action. I didn't use any inline policy like canSee
or canRun
on this new action. But I still get 404 because it's trying to locate action on the resource.
I don't know what's wrong with my project which leads to this situation though I reinstalled all packages from scratch multiple times today.
I wish I could provide a source for reproducing this.
@crynobone Finally, I reproduced it on a new project:
https://github.com/TheSETJ/laravel-nova-on-row-lens-action-404
I copied composer.json
along with some of the configurations from my main project. Admin
is the model used as the Nova user. You also need to have 2 databases. User
model is being read from the other database which I defined its configurations under the name of resource-connection
.
I removed optimistdigital/nova-sortable
and the action work again. The package override ResourceTableRow.vue
and revert laravel/nova#1006 which cause your application to stop working.
@crynobone Thanks, I upgraded to the latest version of the package, but the issue persists. So, I've reported the issue to the owner of the package.
I was using https://github.com/Flagstudio/nova-actions-left
which also overrides resource-table-row
so that must be why I was also having this issue
Description:
Pretty sure I found a bug here.
I have a User resource with some actions but not the lens action in question. My user resource has a lens. If I add an action inside my lens I get a 404 when trying to execute the action with
->showOnTableRow()
Interestingly, if I don't use
->showOnTableRow()
in my lens action, then it does work.If I include this same action on my parent resource, then the lens action also works.
This is my action call
The action itself is a blank that doesn't do anything except logging for the moment.
tldr: if parent resource has no actions, and lens action uses
->showOnTableRow()
, then the action causes a 404 route not found