我在flutter项目中使用Ferry实现了graphql,但是在安装过程中,我遇到了一个无法生成graphql模式的循环。
PS THE_PROJECT_PATH > flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 597ms
[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 1.4s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 923ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms
[INFO] Running build...
[SEVERE] ferry_generator:req_builder on lib/graphql/schema.graphql:
FormatException: Invalid UTF-8 byte (at offset 0) /// the error occured here
[SEVERE] ferry_generator:req_builder on lib/graphql/schema.graphql:
FormatException: Invalid UTF-8 byte (at offset 0)
[INFO] 1.1s elapsed, 1/2 actions completed.
[INFO] 2.1s elapsed, 1/2 actions completed.
[INFO] 3.2s elapsed, 1/2 actions completed.
[INFO] 4.3s elapsed, 1/2 actions completed.
[INFO] 5.4s elapsed, 1/2 actions completed.
[INFO] 6.5s elapsed, 1/2 actions completed.
[INFO] 7.6s elapsed, 1/2 actions completed.
[INFO] 8.7s elapsed, 1/2 actions completed.
[INFO] 9.8s elapsed, 1/2 actions completed.
[INFO] 10.8s elapsed, 1/2 actions completed.
[INFO] 11.9s elapsed, 1/2 actions completed.
[INFO] 13.0s elapsed, 1/2 actions completed.
[INFO] 14.1s elapsed, 1/2 actions completed.
[WARNING] No actions completed for 15.1s, waiting on:
- gql_build:data_builder on lib/graphql/schema.graphql
[INFO] 16.2s elapsed, 1/2 actions completed.
[INFO] 17.3s elapsed, 1/2 actions completed.
[INFO] 18.4s elapsed, 1/2 actions completed.
[INFO] 19.4s elapsed, 1/2 actions completed.
[INFO] 20.5s elapsed, 1/2 actions completed.
[INFO] 21.6s elapsed, 1/2 actions completed.
[INFO] 22.6s elapsed, 1/2 actions completed.
[INFO] 23.7s elapsed, 1/2 actions completed.
[INFO] 24.7s elapsed, 1/2 actions completed.
[INFO] 25.8s elapsed, 1/2 actions completed.
[INFO] 26.9s elapsed, 1/2 actions completed.
... // And it didn't stop and looped for ever, I need to force stop
我已经尝试重新创建项目与相同的依赖关系,但相同的结果。
2条答案
按热度按时间i86rm4rw1#
Ferry文件规定:“如果我们的GraphQL模式包含自定义标量类型,我们需要配置Ferry的代码生成器来正确处理它们”。
https://ferrygraphql.com/docs/custom-scalars/
xmakbtuz2#
此错误是因为运行
get-graphql-schema [ENDPOINT_URL] > lib/schema.graphql
将生成schema.graphql
在不同的文件编码比utf-8
。您需要复制生成的schema.graphql
的内容,并创建不同的schema.graphql
文件自己和粘贴的内容和不同的生成的。