Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Unable to upload profile picture (Internal Server Error) #15895

Closed
tyhdefu opened this issue Jul 9, 2023 · 2 comments
Closed

Unable to upload profile picture (Internal Server Error) #15895

tyhdefu opened this issue Jul 9, 2023 · 2 comments

Comments

@tyhdefu
Copy link

tyhdefu commented Jul 9, 2023

Description

When trying to upload a profile picture, the operation fails, giving me an error on my client of "Error Internal server error".
Inside the homeserver.log it has the following error AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Steps to reproduce

Setup nginx with reverse proxy, and add matrix

  • source ~/synapse/env/bin/activate
  • pip install --upgrade pip virtualenv six packaging appdirs
  • pip install --upgrade setuptools
  • source ~/synapse/env/bin/activate
  • pip install matrix-synapse
  • python -m synapse.app.homeserver --server-name my_home_server_ip.... --config-path homeserver.yaml --generate-config --report-stats=no
  • synctl start
  • Observe matrix working properly for sending messages and logging in.
  • Attempt to upload profile picture
  • Observe error on client and python error on homeserver.log

Homeserver

My own homeserver I just set up.

Synapse Version

1.87.0 (Python 3.10.6)

Installation Method

pip (from PyPI)

Database

SQLite AFAIK

Workers

I don't know

Platform

Ubuntu arm, virtual python environment

Configuration

No response

Relevant log output

2023-07-09 12:22:43,318 - synapse.http.site - 569 - WARNING - sentinel - forwarded request lacks an x-forwarded-proto header: assuming https
2023-07-09 12:22:56,262 - synapse.http.site - 569 - WARNING - sentinel - forwarded request lacks an x-forwarded-proto header: assuming https
2023-07-09 12:22:56,263 - synapse.access.http.8008 - 461 - INFO - GET-100 - 81.102.243.198 - 8008 - {None} Processed request: 0.000sec/0.001sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 857B 200 "GET /_matri
x/client/versions HTTP/1.0" "Element/1.6.3 (samsung SM-G960F; Android 10; QP1A.190711.020.G960FXXUHFVG4; Flavour GooglePlay; MatrixAndroidSdk2 1.6.3)" [0 dbevts]
2023-07-09 12:22:58,961 - synapse.http.site - 569 - WARNING - sentinel - forwarded request lacks an x-forwarded-proto header: assuming https
2023-07-09 12:22:58,962 - synapse.media.media_repository - 204 - INFO - POST-101 - Stored local media in file '/home/xxx/synapse/media_store/local_content/xh/vx/DspdAHBkJLjvAKqZLyJy'
2023-07-09 12:22:58,967 - synapse.http.server - 133 - ERROR - POST-101 - Failed handle request via 'UploadResource': <XForwardedForRequest at 0xffff8c572dd0 method='POST' uri='/_matrix/media/r0/upload?filenam
e=IMG_20221013_182729_069_e_1688905376003.jpg' clientproto='HTTP/1.0' site='8008'>
Traceback (most recent call last):
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/http/server.py", line 319, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/http/server.py", line 349, in _async_render
    callback_return = await raw_callback_return
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/rest/media/upload_resource.py", line 95, in _async_render_POST
    content_uri = await self.media_repo.create_content(
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/media/media_repository.py", line 215, in create_content
    await self._generate_thumbnails(None, media_id, media_id, media_type)
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/media/media_repository.py", line 797, in _generate_thumbnails
    t_byte_source = await defer_to_thread(
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/twisted/python/threadpool.py", line 244, in inContext
    result = inContext.theWork()  # type: ignore[attr-defined]
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/twisted/python/threadpool.py", line 260, in <lambda>
    inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/logging/context.py", line 969, in g
    return f(*args, **kwargs)
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/media/thumbnailer.py", line 172, in crop
    with self._resize(scaled_width, scaled_height) as scaled_image:
  File "/home/xxx/synapse/env/lib/python3.10/site-packages/synapse/media/thumbnailer.py", line 134, in _resize
    return self.image.resize((width, height), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Anything else that would be useful to know?

Same result when using both the element android app and the web client at riot.im

@dklimpel
Copy link
Contributor

dklimpel commented Jul 9, 2023

Duplicate to #15873 ?

@tyhdefu
Copy link
Author

tyhdefu commented Jul 9, 2023

Thanks, indeed it was, missed that when searching because it was more general.

@tyhdefu tyhdefu closed this as completed Jul 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants