bradleyg / django-s3direct

Directly upload files to S3 compatible services with Django.
MIT License
653 stars 234 forks source link

document.body doesn't exist yet when calling oberver.observe #248

Closed e-monson closed 2 years ago

e-monson commented 2 years ago

I'm using Django 4.0.3, and I have a pretty minimal model and admin:

model:

class Hotdog(models.Model):
    hotdog_file = S3DirectField(dest="hotdogs")

admin:

class HotdogAdmin(admin.ModelAdmin):
    list_display = ("hotdog_file",)

admin.site.register(Hotdog, HotdogAdmin)

When I try to add a Hotdog on my admin site, I get the following error in my browser's console:

Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.

I'm guessing this is the offending line of code. It sounds like document.body doesn't exist yet when this is called: https://github.com/bradleyg/django-s3direct/blob/master/src/index.js#L284

hugobessa commented 2 years ago

I'm struggling with the same issue. I had to downgrade to v1.1.8 to make it work.

bradleyg commented 2 years ago

Should be fixed in the latest release.