Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

create-page-modal 404 not found in subfolder operation [DevTools] #666

Closed m-tominaga2022 closed 1 year ago

m-tominaga2022 commented 1 year ago

Hi,

Similar to https://github.com/Laravel-Backpack/community-forum/issues/497

I specified the subfolder name in asset_url of config/livewire.php. I was able to load livewire/livewire.js. However, when I make a modal call (such as create-page-modal), I get 404 not found.

image

The method exists when you call the URL with GET. image

The arisan command also confirms that the livewire method exists.

# php artisan route:list --path=livewire

GET|HEAD   livewire/livewire.js ........................................ Livewire\Controllers ? LivewireJavaScriptAssets@source
GET|HEAD   livewire/livewire.js.map .............................. Livewire\Controllers ? LivewireJavaScriptAssets@maps
POST           livewire/message/{name} ......................... livewire.message ? Livewire\Controllers ? HttpConnectionHandler
GET|HEAD   livewire/preview-file/{filename} ............. livewire.preview-file ? Livewire\Controllers ? FilePreviewHandler@handle
POST           livewire/upload-file .................................... livewire.upload-file ? Livewire\Controllers ? FileUploadHandler@handle
POST           {locale}/livewire/message/{name} ........ livewire.message-localized ? Livewire\Controllers ? HttpConnectionHandler

If it is an environment without local subfolder specification, it works.

image

Do you have any clues to solve this?

comoser.json

"require": {
        "php": "^8.2",
        "backpack/crud": "^6.2",
        "backpack/pro": "^2.0",
        "backpack/theme-tabler": "^1.1",
        "barryvdh/laravel-snappy": "^1.0",
        "doctrine/dbal": "^3.1",
        "guzzlehttp/guzzle": "^7.2",
        "h4cc/wkhtmltopdf-amd64": "0.12.x",
        "jeroennoten/laravel-adminlte": "^3.7",
        "laravel-notification-channels/google-chat": "^3.1",
        "laravel/framework": "^10.0",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "laravelcollective/html": "^6.2",
        "livewire/livewire": "^2.12",
        "maatwebsite/excel": "^3.1",
        "nesbot/carbon": "^2.54",
        "prologue/alerts": "^1.0",
        "yajra/laravel-oci8": "^10"
    },
    "require-dev": {
        "backpack/devtools": "^2.0",
        "backpack/generators": "^4.0",
        "barryvdh/laravel-debugbar": "^3.6",
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.0",
        "spatie/laravel-ignition": "^2.0"
    },
promatik commented 1 year ago

Hi @m-tominaga2022, it really looks like you're having the same issue as https://github.com/Laravel-Backpack/community-forum/issues/497.

As you can see by the error; image

You are checking the route without the prefix, it starts with /livewire/message/..., and the error says the route exists for the POST method. So indeed the error is the lack of the prefix.


But, on #497, the developer was not using a prefix on the URL, but on the assets. And in your case you're using the prefix on the whole app, and that lead me to https://github.com/livewire/livewire/pull/2662. There you can see Livewire apparently doesn't support subfolder installs. And there's more about it here; https://github.com/livewire/livewire/discussions/5731.

Unfortunately, there's nothing we could do about it on our side, it's a livewire issue, sorry about the trouble, can you move your project out of the subfolder?

m-tominaga2022 commented 1 year ago

Thank you for answering.

I will consider using the project in the root folder.