laravel / nova-issues

553 stars 35 forks source link

Can't update resource with image in Firefox #273

Closed slavarazum closed 5 years ago

slavarazum commented 5 years ago

When resource has image field and you try to update resource by Update or Update & Continue, JavaScript throws error

Unhandled promise rejection TypeError: "e.t0.response is undefined"

Screenshot

But when you choose a file it works fine.

MacOS High Sierra 10.13.6 Firefox 61.0.2

jernejcvek commented 5 years ago

I have the same issue (also reported in #135) on Firefox 61.0.2 @ Ubuntu 16.04 LTS.

However, in Chrome (68.0.3440.106) updating resource without Image does not cause problems.

bradykeeling commented 5 years ago

I'm having the same issue in the latest version of FIrefox.

I also receive an error in Chrome when I try to update a resource that already has an image attached. It tells me that the field is required.

This happens when the field is not set to nullable in the migration.

screen shot 2018-08-28 at 11 46 20 am

jernejcvek commented 5 years ago

From Laravel 5.6 documentation: Laravel 5.6 Database: Migrations If the field is not set to nullable, then it's not allowed to store NULL to database.

So I think the behavior in your case (in Chrome) is correct, because you didn't select the image and so Nova wants to store NULL into this field - which would database refuse.

On the other hand, Laravel Nova seems to have issues with updating image in Firefox also when nullable() is set on image's column.

bradykeeling commented 5 years ago

Thanks for the response @jernejcvek.

For this example the image is already attached to the model, but when I try to update it, it says that the image field is required (even though the location is obviously being stored in the database field, because it's showing a thumbnail of the image).

Does that make sense? Am I just missing something obvious?

bradykeeling commented 5 years ago

It appears that my problem is a bit different than the initial post, so I moved it to #353

HUN-Julian commented 5 years ago

Hi Folks,

I have exactly the same issue with simple file field on update event. Is there any solution? Nova v1.0.8 | FF 60.0.2 (64-bit)

v1nk0 commented 5 years ago

I can confirm that updating a resource with an image-field is not possible with Firefox if you are not sending a new image each time. Tested with Nova 1.0.12 and FF 61.0.2 Windows as well as FF 61.0.2 macOS.

screen shot 2018-09-07 at 12 47 08

This also happens without having a "required" rule for the image field. It only works when I send a new file with the update request.

With Edge I'm experiencing a server-error on exactly the same action (updating with a image already present and not sending a new image):

screen shot 2018-09-07 at 12 50 44

The exact same action works perfectly fine with Chrome though.

Navi2016 commented 5 years ago

Creating a new post without sending an image does not seem to work in firefox either. Field is nullable and not required, still getting the above js error.

When selecting an image and then trying to save makes the validation for the rest of the form work.

DonDiegoAA commented 5 years ago

This bug is still there with Nova 1.1.3 and Firefox

davidhemphill commented 5 years ago

This has been fixed and will be included in an upcoming release.

duykpro commented 5 years ago

Same issue here, cant update on Firefox

sheldonkotyk commented 5 years ago

Also an issue in Safari.

v1nk0 commented 5 years ago

@duykpro @sheldonkotyk The latest release (v1.1.4) is from October 1st and @davidhemphill wrote on October 2nd that a fix will be included in an upcoming release, so I guess there's nothing but to wait for a Nova release with the fix.

@davidhemphill can you confirm that a fix is included in the next release, because you've wrote an upcoming release, which doesn't necessarily means the next ;)? Any ETA on the next release?

jmonday-ci commented 5 years ago

I'm also experiences this same issue in Firefox when attempting to update a model that has an image already attached to said model. In this case, I'm not re-attaching an image as it already has one, preview is shown and everything. I get the error:

Unhandled promise rejection TypeError: "e.t0.response is undefined, can't access property "status" of it"

@davidhemphill can you confirm which version has the fix? I'm using Nova v1.1.4. Thanks!

jwahdatehagh commented 5 years ago

I'm on 1.1.4 as well and can confirm this is not fixed yet.

XGhozt commented 5 years ago

I'm assuming this will be fixed soon, we haven't had a release in nearly 4 weeks now.

UdyW commented 5 years ago

This is a major issue!!! Its now happening in chrome as well.

Reproduce steps;

  1. Save image with the record
  2. Select the record to edit
  3. Try updating the record changing something other than the image field.
screenshot 2018-10-24 at 09 44 09

` public function fields(Request $request) { return [ ID::make()->sortable(),

        Text::make('Title')
            ->sortable()
            ->rules('required', 'max:255'),

        Text::make('Header title')
            ->sortable()
            ->rules('required', 'max:254'),

        Text::make('Header caption')
            ->rules('required', 'string', 'min:6'),

        Image::make('Banner Image')
            ->rules('required'),

        Textarea::make('Content')
            ->rules('string', 'min:6'),

        Text::make('Slug')
            ->resolveUsing(function($slug){
                return str_slug($slug);
            }),
    ];
}`

Hope this will be fixed soon.

flexchar commented 5 years ago

Briefly confirming bug, updating resource does nothing when on Firefox, Edge. Chrome works fine.

Navi2016 commented 5 years ago

The Nova releases seem to have stopped, feel kind of ripped off.

tiagosimoesdev commented 5 years ago

we all got in the hype train . Bought nova , really tried for two weeks to build a custom admin panel , but the amount of work / effort is just not really worth .

I think nova it's an "extra" for an admin panel if it's simple enough. Back to backpack ..

jmonday-ci commented 5 years ago

@tiagosimoesdev Thanks for the tip on Backpack. Looks like a great package!

tiagosimoesdev commented 5 years ago

@jmonday-ci not the best place to promote it ( I'm not in any way affiliated with backpack ) , but it's really great that the community can help it develop .

lvdhoorn commented 5 years ago

Personally i think Nova is a great tool to work with. The problem with downloading an image or updating a resource that already contains an image does not work in Nova 1.1.8. For now we just use Chrome but it would be nice if the bug gets fixed.

v1nk0 commented 5 years ago

First off: Nova is a great tool, no doubt about that.

That said, I just expected this bug to be solved by now, as it was stated "fixed" by @davidhemphill 51 days ago (https://github.com/laravel/nova-issues/issues/273#issuecomment-426138637 and https://github.com/laravel/nova-issues/issues/378#issuecomment-426138526) In the meantime there has been 4 new Nova releases, but none of them fixed this problem and there has been no further feedback by the developers.

Mind you, that there is a quick-fix out there that seems to solve the problem (at least it solves it for me): https://github.com/laravel/nova-issues/issues/378#issuecomment-420696080 I just re-apply it after each Nova update, but I hope the problem will finally get fixed by the Nova team!

rovansteen commented 5 years ago

I think it's better to create a new issue if a bug is not fixed (properly) rather than keep commenting on closed issues. I doubt they will check comments on closed issues.

slavarazum commented 5 years ago

Have no this issue on 1.1.8 version. Did you republish nova assets?

php artisan vendor:publish --tag=nova-assets --force
lvdhoorn commented 5 years ago

@slavarazum did you try to edit a resource that already has an image in FireFox? Because that is the problem. In Chrome it is working fine. Running php artisan vendor:publish --tag=nova-assets --force did not solve the problem :(

slavarazum commented 5 years ago

@lvdhoorn Yes, for example if user already have an avatar, I can change it. My Firefox Version: My Firefox Version Also try to:

php artisan view:clear

And refresh FireFox cache.

lvdhoorn commented 5 years ago

@slavarazum weird i have the same version FireFox, I run php artisan view:clear and my cache is cleared. In the console is see the following error when i hit the update button Unhandled promise rejection TypeError: "e.t0.response is undefined"

slavarazum commented 5 years ago

@lvdhoorn Sounds strange. Are you on 1.1.8 version? Maybe try it on fresh Laravel installation.

XGhozt commented 5 years ago

@lvdhoorn I have an issue every time I update Nova. For some reason, I have to manually delete the public/vendor/nova folder and run php artisan nova:publish in some cases, with the --force option, too. It's possible you updated Nova but the javascript files are still the old version. Check the modified date on those files to make sure they're the new ones.

davidhemphill commented 5 years ago

You have to update Nova's published assets every time you upgrade to a new version or you won't get the new versions of them. 👍 php artisan nova:publish

XGhozt commented 5 years ago

@davidhemphill -- Yes, however, for some reason on some computers nova:publish doesn't actually publish anything. Not sure if it's a permission issue or something else. But they don't get replaced. It usually works after I delete the folder. It was very confusing the first time. Maybe if the command to publish actually confirmed that files were published, otherwise we just assume it worked when nothing happened.

Edit: Also if you're coming from an even older version of Nova, I believe they were in a different location which threw me off even more. I ran into this a month ago or so. I can't remember the details now.

Edit2: In some cases I also had to delete the vendor folder and re-install nova because either the symlink was broken or there was some permission issue there, too. On some machines if a symlink isn't possible, it copies the nova files instead. If you have a copy, and then it doesn't update for some reason (copy again) then you still have the old version AND the new version. If that happens, then publish just copies the old files again.

serge-lukianov commented 5 years ago

php artisan nova:publish --force will write new versions for sure. But you might lose changes in nova files (including config/nova.php)

davidhemphill commented 5 years ago

What's the consensus here? I've revisited this issue and from my tests can't reproduce the problem. Is it fixed or not? From what I can tell, it is.

lvdhoorn commented 5 years ago

The problem still exist in our application in Firefox 63.0.3 and Nova 1.2.0.

I have tried php artisan nova:publish --force without luck.

We run Nova with Composer and the app url is just /

In Google Chrome and Safari it is working fine.

In FireFox when i want to update the resource i see the picture but i can't save the resource until i select the picture again from the computer by clicking browse. If i not select the picture i get the following error in the console;

Unhandled promise rejection TypeError: "e.t0.response is undefined"

When viewing the detail page from a resource i see the picture but i can't download it. When i click on download there are no errors in the console.

In Safari downloading is working but updating not (version 12.0.1).

In Google Chrome both is working (version 70.0.3538.110)

XGhozt commented 5 years ago

@lvdhoorn -- did you try my solution? Short list:

  1. Delete your /vendor folder
  2. Delete your /public/vendor/nova folder
  3. Confirm /nova is up to date (best way might be to delete the nova folder and add a fresh copy)
  4. Run composer install (re-add vendor folder)
  5. Run php artisan nova:publish (re-add public vendor folder)
  6. Clear your browser cache

I might also recommend php artisan cache:clear

lvdhoorn commented 5 years ago

Oké the problem is solved. We have a couple off custom views and they where pointing to the old asset folder. The old asset folder was still on the server so there where no errors.

jakobfdev commented 5 years ago

Still not working in my case v1.2.1

dsampaolo commented 5 years ago

I finally managed to solve this by republishing Nova assets, as stated by @davidhemphill. Problem solved on Firefox Nightly.

My assets were in /public/nova-assets, they now are in /public/vendor/nova. Hope this helps.

mrigo commented 5 years ago

Hello, the issue for me is still present with Nova 1.3.2. I've tried republishing Nova but with no luck. I'm using S3 as a disk, could be this the cause?

public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
            Text::make('Name', 'name')->sortable()->rules('required'),
            Number::make('Latitude', 'lat')->step(0.00000001)->rules('required'),
            Number::make('Longitude', 'lng')->step(0.00000001)->rules('required'),
            Number::make('Range (mt)', 'range')->onlyOnForms(),
            Number::make('Range', function() {
                return $this->range." mt";
            }),
            File::make('Audio file', 'audio')
                ->disk('s3')
                ->path('audio_files')
                ->storeSize('attachment_size')
                ->rules('required','mimetypes:audio/mpeg,audio/x-aac,audio/x-aiff')
                ->storeAs(function(Request $request){
                    return $request->audio->getClientOriginalName();
                }),
        ];
    }

Here the error message when I try to update the resource even if the file is already present:

Schermata 2019-05-10 alle 16 08 28

Thanks \m

mrigo commented 5 years ago

Hello, anyone?

Navi2016 commented 5 years ago

The issue is closed (and seems fixed for me), if you still have problems and want a response, please open a new ticket or re-open this one.

mrigo commented 5 years ago

I've digged about, found ->creationRules ->updateRules still not so intuitive solution but working, thanks!

paperscissors commented 3 years ago

A bit confused why this is still a thing on 3.0/dev-master. Hadn't seen this before but for some reason it's happening to me now --- and I don't even have an image field on this resource.

crynobone commented 3 years ago

@paperscissors This is a 2 year old issue, if you have a new issue related to this please create a new issue with full details and reproducing steps.