eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Home Page:https://eggjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

config.default.ts 添加async配置报Please set config.keys first

zldoc88 opened this issue · comments

在此输入你需要反馈的 Bug 具体信息(Bug in Detail):

// config.default.ts
const initConfig=async (appInfo: EggAppInfo) => {
// todo config
}

export default initConfig;

// 主要这个匿名函数 加 “async”就会报 “Please set config.keys first”
// 有没什么解决方法,因为项目要在启动的时候动态buildSchema ,一个异步处理。

可复现问题的仓库地址(Reproduction Repo)

都存在

Node 版本号:

16.15.1

Eggjs 版本号:

3.15.0

相关插件名称与版本号(PlugIn and Name):

操作平台与版本号(Platform and Version):

mac

我的不加async 也报这个错,很奇怪

我的不加async 也报这个错,很奇怪

一般是上下文异常导致配置问题。
egg 用js还能玩玩,用ts 建议还是踏踏实实用nestjs吧。

我的不加async 也报这个错,很奇怪

问题解决了,需要执行下tsc