Skip to content
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

Save Images: Unhandled Promise Rejection: TypeError #378

Closed
StanBarrows opened this issue Aug 31, 2018 · 29 comments
Closed

Save Images: Unhandled Promise Rejection: TypeError #378

StanBarrows opened this issue Aug 31, 2018 · 29 comments

Comments

@StanBarrows
Copy link

StanBarrows commented Aug 31, 2018

After that I've created an Object with an Image, I'm not able to update the Model without selecting a new Image. Evena Image is already attached to the Model.

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'e.t0.response.status')

image

   Image::make('Member Photo')
                ->sortable()
                ->rules('required','image')
                ->disk('public'),

Safari: Version 11.1.2 (13605.3.8)

@v1nk0
Copy link

v1nk0 commented Sep 4, 2018

A problem exists if you add the rule "required", because always need to send an image (at least at the moment, same goes for file and avatar field-type) The fact that an image (or file / avatar) is already present does not affect the "required"-rule.
See #353

In Firefox and Chrome (macOS) this is at least clear as normal validation errors are shown.
In Safari (macOS) though, no validation errors are shown. Instead, the console shows a js-error:

screen shot 2018-09-04 at 15 08 44

It seems to be the same error as @StanBarrows gets.

Clicking on that errors shows following error-position:

screen shot 2018-09-04 at 15 09 12

And stack trace:

screen shot 2018-09-04 at 15 11 57

-> The Safari error also occurs when the image (or file / avatar) field is not set to "required" by a rule.

@krisons
Copy link

krisons commented Sep 6, 2018

Same problem. Safari on Mac

@sijones-uk
Copy link

sijones-uk commented Sep 7, 2018

Also seeing this problem, Firefox 61.0.2 on a PC. Chrome on a PC is fine. If you select an image you can save the model, but if you edit a model with an existing image, you can't save it.

I wasn't able to find a workaround, which is a bit of a problem if you want to use an Image/Avatar field.

@weeman1337
Copy link

Same with Firefox 62.0

@AegirLeet
Copy link

The real error is

TypeError: "Argument 2 of FormData.append is not an object."

Triggered in FileField.vue (the formData.append(...) bit).

@v1nk0
Copy link

v1nk0 commented Sep 12, 2018

@AegirLeet did you manage to make a workaround?

This problem is making it impossible to use Firefox or Edge (I even believe it only works without problems if you use Chrome) as soon as a File field (this includes Image and Avatar) is on a resource and a new file is not necessarily needed each time you update a record of this resource.

Problem still occurs with the latest Nova (v1.0.15)

@AegirLeet
Copy link

@v1nk0 In FileField.vue, look for the formData.append(...) and replace it with

if (this.file) {
    formData.append(...)
}

Seems to be working so far.

@v1nk0
Copy link

v1nk0 commented Sep 12, 2018

@AegirLeet maybe stupid question, but how do I recompile the .js-file of Nova after I made that change in the .vue-file (nova/resources/js/components/Form/FileField.vue) ?

@AegirLeet
Copy link

@v1nk0 Copy the webpack.mix.js.dist to webpack.mix.js and run npm run prod - just like a regular Laravel application.
Then just copy everything from public/ to your application's public/nova-assets/.

@v1nk0
Copy link

v1nk0 commented Sep 12, 2018

@v1nk0 Copy the webpack.mix.js.dist to webpack.mix.js and run npm run prod - just like a regular Laravel application.
Then just copy everything from public/ to your application's public/nova-assets/.

Yes, did that first step.
I think it's too late already, I just forgot to install dependencies first 🤫. Works now.... of course....

@laurencei
Copy link

I've got this same issue. v1.0.16

@DonDiegoAA
Copy link

I'm probably miss something here, but why don't you use creationRules and updateRules ?

Avatar::make('Image')->disk('public')
                ->creationRules('required', 'image','mimes:jpg,jpeg,png,gif')
                ->updateRules('nullable', 'image','mimes:jpg,jpeg,png,gif'),

@v1nk0
Copy link

v1nk0 commented Sep 13, 2018

@DonDiegoAA this issue has nothing to do with the required-rule.
Even if you don't set the field to be required, the error occurs (at least with when not using Chrome)

@DonDiegoAA
Copy link

Ok, I see that on Firefox too now, sorry I should have read better.

@cdupoiron
Copy link

same issue on 1.1 and 1.1.1 on FF

@laurencei
Copy link

Yeah - I checked as well.

Latest Nova versions 1.1.1 on Firefox - promises error
Same website/page on Chrome - no issue

@tufankilicaslan
Copy link

Same issue here: (nova version 1.0.19)

Avatar field with following details:

Avatar::make('Avatar')->disk('public') ->path('avatar') ->prunable() ->hideWhenCreating() ->rules('nullable'),

is giving the following error on FF: ( Firefox version 62.0 (64-bit) for Ubuntu)

Unhandled promise rejection TypeError: "_context2.t0.response is undefined" _callee2 http://laravel.local/vendor/nova/vendor.js?id=a17854ec0fcced7c87f7:95225:15 app.js:28755:11 onUnhandled

It's working good on Chrome.

@eblount
Copy link

eblount commented Sep 23, 2018

Confirm that the issue still exists in 1.1.3 on Firefox

@vootrunner
Copy link

The issue still exists in 1.1.3 on Safari too

@ghost
Copy link

ghost commented Oct 1, 2018

The issue still exists in 1.1.4 on Safari and Firefox

@davidhemphill
Copy link
Contributor

This has been fixed and will be included in an upcoming release. Sorry it took so long!

@laurencei
Copy link

@davidhemphill - any chance the next release can be tagged with this fix?

@nickpoulos
Copy link

Is this fix available to use yet? I believe I am using the latest Nova release but I am still seeing this bug.

@laurencei
Copy link

@nickpoulos - no unfortunately.

It'll be in the "next" release of Nova (ETA unknown)

@sabid
Copy link

sabid commented Oct 22, 2018

Please help, whit this BUG.

@alberto-bottarini
Copy link

Any news?
I'm still having this error: Unhandled promise rejection TypeError: "e.t0.response is undefined; can't access its "status" property"

@jakobfdev
Copy link

jakobfdev commented Jan 4, 2019

// EDIT: Had a problem with third party field. Done.
Naxon/nova-field-sortable#16

@ceejayoz
Copy link

ceejayoz commented Mar 4, 2019

@jboka Thanks, this was our issue as well.

@sanasol
Copy link

sanasol commented Mar 7, 2019

Regression probably

v1.3.2

again same error

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests