Skip to content

PUI CORS issues only with the default part image  #5948

Closed

Description

@wolflu05

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

If I open a part with an black image in PUI I have the following errors in console:
image

Steps to Reproduce

  1. Run PUI on another port than the dev server in dev mode
  2. open the parts list table which renders parts without a part image
  3. See errors in browser console

Expected behaviour

no errors, /static/img/blank_image.png should load as the other images.

Deployment Method

  • Docker
  • Bare metal

Version Information

Version Information:

InvenTree-Version: 0.13.0 dev
Django Version: 3.2.23
Commit Hash: 53bd75e
Commit Date: 2023-11-16
Commit Branch: pui-improvements
Database: sqlite3
Debug-Mode: True
Deployed using Docker: False
Platform: Linux-5.15.49-linuxkit-pr-x86_64-with-glibc2.31
Installer: GIT

Please verify if you can reproduce this bug on the demo site.

  • I can reproduce this bug on the demo site.

Relevant log output

No response

Activity

  1. added
    bug
    question
    triage:not-checked
    User Interface
    on Nov 20, 2023
  2. SchrodingersGat commented on Nov 20, 2023

    @SchrodingersGat
    Member

    I believe this is related to how Django handles static files in particular, with the "development" server.

    Ref: https://stackoverflow.com/questions/55751033/django-cors-on-static-asset

  3. removed
    question
    triage:not-checked
    on Nov 20, 2023
  4. wolflu05 commented on Nov 30, 2023

    @wolflu05
    MemberAuthor

    Should we then use this --nostatic method for development by default and setup the static handlers ourselves?

  5. SchrodingersGat commented on Nov 30, 2023

    @SchrodingersGat
    Member

    I think we might have to, yeah

  6. added this to the 0.14.0 milestone on Dec 15, 2023
  7. SchrodingersGat commented on Jan 22, 2024

    @SchrodingersGat
    Member

    @wolflu05 this may have been fixed now with latest CORS fixes - can you please confirm when you have a chance?

  8. wolflu05 commented on Jan 23, 2024

    @wolflu05
    MemberAuthor

    I still have the error, do I need to do something specific or just pull the newest code? (I tested with d502d93)

  9. SchrodingersGat commented on Jan 23, 2024

    @SchrodingersGat
    Member

    @wolflu05 have you tried with a private browser session? There may still be some issues with old sessions muddying the waters

  10. wolflu05 commented on Jan 23, 2024

    @wolflu05
    MemberAuthor

    Tried now, still the same behavior.
    So to clarify, what I did:

    1. run inventree server on port 8000
    2. run pui via npm run dev
    3. connect to http://localhost:5137, add a new server pointing to http://localhost:8000
    4. open the parts page where a lot of parts that have no image are shown
    5. See the errors in the dev console
  11. SchrodingersGat commented on Jan 23, 2024

    @SchrodingersGat
    Member

    I have just retried locally, with the server pointing at both localhost:5173 and localhost:8000 - both seem to work on my end. Do the tables load? Just the images are not coming through?

  12. wolflu05 commented on Jan 23, 2024

    @wolflu05
    MemberAuthor

    Everything loads, just tested again with chrome (was using safari before on macos). Everything loads, except the image of parts that have no part image. Same for the demo server with a locally run frontend. Because I get a lot of these errors:
    image

    Do you also run the frontend on port 5137 and accessed it through that port and than added a new server host at localhost:8000, selected that and opened the parts list where parts are shown that have no image associated?

    Is there something that I need to configure first on the inventree dev server?

    And I also get a lot of these prompts that quickly close after they are shown
    image

    This could be related to these rejected responses from the server that appear in the console:
    image

    Here you can see that there is a WWW-Authenticate: Basic realm="api" header send back from the server that indicate for the browser to show such a basic login dialog:
    image

  13. SchrodingersGat commented on Jan 23, 2024

    @SchrodingersGat
    Member

    Ah, ok for the static files I am also getting a CORS error still:

    image

    This is separate to the issues that I have recently been looking into.

  14. matmair commented on Feb 9, 2024

    @matmair
    Member

    I think this was addressed. Can you validate if it now works on your setup @wolflu05? I'm not sure if my config or the code makes it work.

  15. wolflu05 commented on Feb 9, 2024

    @wolflu05
    MemberAuthor

    Tested with 8638f3b, but it's still not working, still getting these CORS issues from the initial post. Do I have to configure something special?

  16. matmair commented on Feb 9, 2024

    @matmair
    Member

    It should not need configuration, maybe my specific CORS settings for dev address it but they are insecure for deploy so we need to look into this properly.

  17. modified the milestones: 0.14.0, 0.15.0 on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    User Interfacebug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions