Skip to content

upload file failed #10597

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

Closed
5 tasks done
ljwps opened this issue Nov 12, 2024 · 11 comments
Closed
5 tasks done

upload file failed #10597

ljwps opened this issue Nov 12, 2024 · 11 comments
Assignees
Labels
🐞 bug Something isn't working 🤔 cant-reproduce We can not reproduce it or the information is limited

Comments

@ljwps
Copy link

ljwps commented Nov 12, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.11.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Upgrade from 0.6.x to 0.11.1

Upgrade Process:

  1. The local version was originally 0.6.x from Git.
  2. Switched to the 0.11.1 tag.
  3. Ran docker-compose down.
  4. Ran docker-compose pull.
  5. Ran docker-compose up -d.

After starting up, I created a node with a file upload feature for testing. When trying to upload a .docx file in the preview mode, an error appeared saying "File type not supported." I also tried uploading an .xlsx file and encountered the same error. However, uploading an .xml file was successful.

Using the browser's F12 developer tools to inspect the file upload request, I noticed that no request was actually sent. This suggests that the file type check is performed on the client side, as there are no error logs on the server.

Screenshots
image

image

image

image

image

Additionally, one of the Docker images repeatedly fails to start and keeps restarting after the upgrade.
image

✔️ Expected Behavior

upload file success

❌ Actual Behavior

File type not supported

@dosubot dosubot bot added the 🐞 bug Something isn't working label Nov 12, 2024
Copy link

dosubot bot commented Nov 12, 2024

@ljwps Hello! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's work together to solve the issue you're facing.

I found a similar closed issue that might be relevant to your problem: workflow files bug, can not upload file. The suggested solution was to ensure that the upload_file_id is correctly set for all local files before attempting to run the workflow. Additionally, check for any limitations related to file uploads, such as upload size limits, batch upload limits, and configuration settings in both cloud and self-hosted environments [1].

In your case, since the error seems to be happening on the client side, you might want to verify the client-side validation script for file uploads. The script checks the file type against a list of allowed extensions and MIME types. Make sure that the file types you are trying to upload (.docx and .xlsx) are included in the allowed file types configuration. This configuration can be found in the fileConfig.allowed_file_types and fileConfig.allowed_file_extensions arrays in the client-side code [2].

If the issue persists, you might need to check the api/constants/__init__.py file in your codebase to ensure that the document extensions list includes the file types you are trying to upload [3].

To continue talking to Dosu, mention @dosu.

@ljwps
Copy link
Author

ljwps commented Nov 12, 2024

@ljwps Hello! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's work together to solve the issue you're facing.

I found a similar closed issue that might be relevant to your problem: workflow files bug, can not upload file. The suggested solution was to ensure that the upload_file_id is correctly set for all local files before attempting to run the workflow. Additionally, check for any limitations related to file uploads, such as upload size limits, batch upload limits, and configuration settings in both cloud and self-hosted environments [1].

In your case, since the error seems to be happening on the client side, you might want to verify the client-side validation script for file uploads. The script checks the file type against a list of allowed extensions and MIME types. Make sure that the file types you are trying to upload (.docx and .xlsx) are included in the allowed file types configuration. This configuration can be found in the fileConfig.allowed_file_types and fileConfig.allowed_file_extensions arrays in the client-side code [2].

If the issue persists, you might need to check the api/constants/__init__.py file in your codebase to ensure that the document extensions list includes the file types you are trying to upload [3].

To continue talking to Dosu, mention @dosu.

According to your suggestions, I checked the source code, and both points 2 and 3 are indeed present. However, the issue still persists.

@thymol-zzw
Copy link

I ran into the same issue, and my version is 0.10.2

@crazywoola crazywoola added the 🤔 cant-reproduce We can not reproduce it or the information is limited label Nov 12, 2024
@crazywoola crazywoola mentioned this issue Nov 12, 2024
5 tasks
@xy3xy3
Copy link

xy3xy3 commented Nov 12, 2024

So are there any solutions here? ()
I met the same probelm which leads to the documents always in queue.
And my environment is in docker and newly installed.

@silverriver
Copy link

Same issue here trying to load files with custom extensions

@xy3xy3
Copy link

xy3xy3 commented Nov 12, 2024

Same issue here trying to load files with custom extensions

I just uploaded file of txt but failed.

@crazywoola
Copy link
Member

See this thread. This should be fixed in next version. #10551 (comment)

#10555
#10563

@ljwps
Copy link
Author

ljwps commented Nov 13, 2024

See this thread. This should be fixed in next version. #10551 (comment)

#10555 #10563

Will the issue with file uploads be resolved in the next version? The IsADirectoryError: [Errno 21] Is a directory: '/app/api' problem has been resolved on my end by following the link you provided.

@Bannerli
Copy link

Bannerli commented Nov 15, 2024

I have encountered same issue.

Warning: Python 3.10 will not be supported in the next version.
Traceback (most recent call last):
  File "/app/api/.venv/bin/celery", line 8, in <module>
    sys.exit(main())
  File "/app/api/.venv/lib/python3.10/site-packages/celery/__main__.py", line 15, in main
    sys.exit(_main())
  File "/app/api/.venv/lib/python3.10/site-packages/celery/bin/celery.py", line 236, in main
    return celery(auto_envvar_prefix="CELERY")
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/app/api/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/celery/bin/base.py", line 135, in caller
    return f(ctx, *args, **kwargs)
  File "/app/api/.venv/lib/python3.10/site-packages/celery/bin/worker.py", line 348, in worker
    worker = app.Worker(
  File "/app/api/.venv/lib/python3.10/site-packages/celery/worker/worker.py", line 98, in __init__
    self.setup_instance(**self.prepare_args(**kwargs))
  File "/app/api/.venv/lib/python3.10/site-packages/celery/worker/worker.py", line 131, in setup_instance
    self.on_init_blueprint()
  File "/app/api/.venv/lib/python3.10/site-packages/celery/apps/worker.py", line 116, in on_init_blueprint
    self._custom_logging = self.setup_logging()
  File "/app/api/.venv/lib/python3.10/site-packages/celery/apps/worker.py", line 180, in setup_logging
    return self.app.log.setup(
  File "/app/api/.venv/lib/python3.10/site-packages/celery/app/log.py", line 63, in setup
    handled = self.setup_logging_subsystem(
  File "/app/api/.venv/lib/python3.10/site-packages/celery/app/log.py", line 117, in setup_logging_subsystem
    self._configure_logger(
  File "/app/api/.venv/lib/python3.10/site-packages/celery/app/log.py", line 150, in _configure_logger
    self.setup_handlers(logger, logfile, format,
  File "/app/api/.venv/lib/python3.10/site-packages/celery/app/log.py", line 216, in setup_handlers
    handler = self._detect_handler(logfile)
  File "/app/api/.venv/lib/python3.10/site-packages/celery/app/log.py", line 226, in _detect_handler
    return WatchedFileHandler(logfile, encoding='utf-8')
  File "/usr/local/lib/python3.10/logging/handlers.py", line 479, in __init__
    logging.FileHandler.__init__(self, filename, mode=mode,
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1169, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1201, in _open
    return open_func(self.baseFilename, self.mode,
IsADirectoryError: [Errno 21] Is a directory: '/app/api'

@crazywoola
Copy link
Member

crazywoola commented Nov 15, 2024

Link #10725
Solution #10602

@crazywoola
Copy link
Member

@Bannerli Please read through above conversations, you can find out how to solve it.

@dosubot dosubot bot mentioned this issue Nov 19, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🤔 cant-reproduce We can not reproduce it or the information is limited
Projects
None yet
Development

No branches or pull requests

7 participants