Marcus-zh / Neodb-Api

Neodb-Api是基于neodb.social(一个致力于为联邦宇宙居民提供自由开放互联的书籍、电影、音乐和游戏收藏评论的空间)的API,是豆瓣的最佳平替
https://neodb-api-one.vercel.app
Apache License 2.0
6 stars 1 forks source link

Vercel 部署的时遇到问题:This Serverless Function has crashed. #2

Open DayuGuo opened 1 week ago

DayuGuo commented 1 week ago

在成功获取access token,并部署vercel后,发现页面无法正常显示。

报错显示: This Serverless Function has crashed.

Your connection is working correctly.

Vercel is working correctly.

500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: hnd1:hnd1::g9x2x-1731592837589-8a95547100d5

CleanShot 2024-11-14 at 22.01.50@2x.png

我使用的是 redirect_uris=urn:ietf:wg:oauth:2.0:oob, 不知道这样是否会对配置有影响。

祝好, Dayu hi@anotherdayu.com

Marcus-zh commented 1 week ago

在成功获取access token,并部署vercel后,发现页面无法正常显示。

报错显示: This Serverless Function has crashed.

Your connection is working correctly.

Vercel is working correctly.

500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ID: hnd1:hnd1::g9x2x-1731592837589-8a95547100d5

CleanShot 2024-11-14 at 22.01.50@2x.png

我使用的是 redirect_uris=urn:ietf:wg:oauth:2.0:oob, 不知道这样是否会对配置有影响。

祝好, Dayu hi@anotherdayu.com

可以在vercel的该项目最后一个development的log看看报错信息 另外,这个redirect_uris是什么用的😧

DayuGuo commented 1 week ago

redirect_uris 是官方文件里的:https://neodb.net/api/ ,用于 Create an application 部分。

报错信息是指:Deployment Details中的Build Logs吗? 其中确实有一条警告: WARN! Due to builds existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings

Marcus-zh commented 1 week ago

redirect_uris 是官方文件里的:https://neodb.net/api/ ,用于 Create an application 部分。

报错信息是指:Deployment Details中的Build Logs吗? 其中确实有一条警告: WARN! Due to builds existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings

首先,是需要按照https://eallion.com/neodb_token 的步骤来获取neodb返回的access_token,而不是填client_id和redirect_uris 其次,不是build log,是runtime log,这个是实时的,需要打开rutime log后,请求一下api才能看到报错

DayuGuo commented 1 week ago

感谢回复

蜗牛老师的教程失效了,所以我用的这个官方教程 https://neodb.net/api/ ,获取的应该是同一个东西。

另外,https://neodb.social/developer/ 页面中的 Test Access Token,其实也是获取的 Access Token,执行效果跟上面教程的一样,更简单些。

runtime log显示在验证 KVConfig 时有 4 个验证错误,url, rest_api_url, rest_api_token, rest_api_read_only_token 这四个字段的验证失败。错误信息表明,这些字段的值必须是有效的字符串类型 (string_type),但实际传入的值为 None。

具体如下: [ERROR] ValidationError: 4 validation errors for KVConfig url Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_url Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_token Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_read_only_token Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type Traceback (most recent call last):   File "/var/lang/lib/python3.12/importlib/init.py", line 90, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   File "", line 1387, in _gcd_import   File "", line 1360, in _find_and_load   File "", line 1331, in _find_and_load_unlocked   File "", line 935, in _load_unlocked   File "", line 995, in exec_module   File "", line 488, in _call_with_frames_removed   File "/var/task/vchandlerpython.py", line 14, in     vc_spec.loader.exec_module(vc_module)   File "", line 995, in exec_module   File "", line 488, in _call_with_frames_removed   File "/var/task/app.py", line 6, in     from redis_color import kv, process_item   File "/var/task/redis_color.py", line 10, in     kv = KV()   File "/var/task/vercel_kv_sdk.py", line 30, in init     self.kv_config = KVConfig(   File "/var/task/pydantic/main.py", line 212, in init     validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) INIT_REPORT Init Duration: 2811.88 ms Phase: invoke Status: error Error Type: Runtime.Unknown

Marcus-zh commented 1 week ago

感谢回复

蜗牛老师的教程失效了,所以我用的这个官方教程 https://neodb.net/api/ ,获取的应该是同一个东西。

另外,https://neodb.social/developer/ 页面中的 Test Access Token,其实也是获取的 Access Token,执行效果跟上面教程的一样,更简单些。

runtime log显示在验证 KVConfig 时有 4 个验证错误,url, rest_api_url, rest_api_token, rest_api_read_only_token 这四个字段的验证失败。错误信息表明,这些字段的值必须是有效的字符串类型 (string_type),但实际传入的值为 None。

具体如下: [ERROR] ValidationError: 4 validation errors for KVConfig url Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_url Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_token Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type rest_api_read_only_token Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.9/v/string_type Traceback (most recent call last):   File "/var/lang/lib/python3.12/importlib/init.py", line 90, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   File "", line 1387, in _gcd_import   File "", line 1360, in _find_and_load   File "", line 1331, in _find_and_load_unlocked   File "", line 935, in _load_unlocked   File "", line 995, in exec_module   File "", line 488, in _call_with_frames_removed   File "/var/task/vchandlerpython.py", line 14, in     vc_spec.loader.exec_module(vc_module)   File "", line 995, in exec_module   File "", line 488, in _call_with_frames_removed   File "/var/task/app.py", line 6, in     from redis_color import kv, process_item   File "/var/task/redis_color.py", line 10, in     kv = KV()   File "/var/task/vercel_kv_sdk.py", line 30, in init     self.kv_config = KVConfig(   File "/var/task/pydantic/main.py", line 212, in init     validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) INIT_REPORT Init Duration: 2811.88 ms Phase: invoke Status: error Error Type: Runtime.Unknown

感觉是kv的问题,应该是kv更新了库没更新,暂时用不了了,我看石姐也换成了直接读json 最近会用node重写个包含电影、游戏、音乐一类的api的😥

DayuGuo commented 1 week ago

好的,感谢解答,期待新工具~