deta / deta-python

deta's official sdk
https://deta.space/docs/en/build/reference/sdk/base
MIT License
153 stars 25 forks source link

broken app #96

Open Huge opened 4 months ago

Huge commented 4 months ago

I had my app prototype working fine, served at https://feed_filtering-1-t6768635.deta.app/

Now I was checking it out if it is still alive, but got the module 'orjson' has no attribute 'JSONEncoder'. In https://deta.space/builder/a09Ng5MgqmYW/develop?tab=overview I see:

[ERROR] AttributeError: module 'orjson' has no attribute 'JSONEncoder'
Traceback (most recent call last):
  File "/var/lang/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/var/task/_entry.py", line 1, in <module>
    from detalib.handler import handle
  File "/opt/python/detalib/handler.py", line 3, in <module>
    from . import handlers
  File "/opt/python/detalib/handlers.py", line 1, in <module>
    from .event import parse_event
  File "/opt/python/detalib/event.py", line 1, in <module>
    from .helpers import json
  File "/opt/python/detalib/helpers.py", line 16, in <module>
    class CustomJSONEncoder(json.JSONEncoder):

Spacefile used:

cat Spacefile
# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
v: 0
micros:
  - name: feed-filtering
    src: .
    engine: python3.9
    primary: true
    public_routes:
        - "/*"

The app still works locally, although I have upd to python3.11 already.

lemonyte commented 4 months ago

Add a run field to your Spacefile with a command to run your server. This will bypass the deprecated detalib component. Docs