Skip to content

modal.exception.DeserializationError occurs when accessing the Chinese URL #4116

@HBcao233

Description

@HBcao233

Summary

When accessing a URL containing Chinese characters, a "modal.exception.DeserializationError" error occurs.

GET /%E6%B8%B8%E6%88%8F/ -> 500 Internal Server Error  (duration: 398.6 ms, execution: 5.2 ms)

Traceback (most recent call last):
  File "/pkg/modal/_serialization.py", line 113, in deserialize
    return Unpickler(client, io.BytesIO(s)).load()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 1: ordinal not in range(128)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/pkg/modal/_runtime/container_io_manager.py", line 947, in handle_input_exception
    yield
  File "/pkg/modal/_container_entrypoint.py", line 125, in run_input_async
    async for value in gen:
  File "/pkg/modal/_runtime/container_io_manager.py", line 270, in call_generator_async
    args, kwargs = self._args_and_kwargs()
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/pkg/modal/_runtime/container_io_manager.py", line 163, in _args_and_kwargs
    deserialized_args.append(deserialize_data_format(input.args, data_format, self._client))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pkg/modal/_serialization.py", line 393, in deserialize_data_format
    return deserialize(s, client)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/pkg/modal/_serialization.py", line 141, in deserialize
    raise DeserializationError(
modal.exception.DeserializationError: Encountered an error when deserializing an object in the remote environment: <class 'UnicodeDecodeError'>('ascii' codec can't decode byte 0xe7 in position 1: ordinal not in range(128)).

Version

1.4.3

App ID

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions