You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As stated in the title a cryptic error arises when running encore run (W11 and Debian WSL tested).
The following is the output from the command line.
$ encore run
⠋ Building Encore application graph...
⠋ Analyzing service topology...
error: missing package name for universe.ts
--> C:\Users\ebalo\Desktop\Projects\rust\KageShirei\server\ks-server\src\utility\log.ts:46:18
|
46 | async (data: Omit<LogContext, "level">) => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
the code snippet where the error resides is the following one:
import{db,JsonValue,LogLevel}from"@/database";import{api}from"encore.dev/api";exporttypeJsonObject={[key: string]: JsonValue}exporttypeJsonArray=Array<JsonValue>exporttypeJsonPrimitive=string|number|boolean|nullexporttypeJsonValue=JsonPrimitive|JsonObject|JsonArrayexportinterfaceLogContext{/** * The log level. */level: LogLevel;/** * The title of the log. */title: string;/** * The message of the log. */message?: string;/** * Any extra data to include in the log. */extra?: JsonValue;}/** * Log a message to the database. * @param ctx The context for the log. */exportconstlog=api({},async(ctx: LogContext)=>{if(ctx.extra){// do things}awaitdb.exec`insert into logs(log_level, title, message) values (${ctx.level}, ${ctx.title}, ${ctx.message||null})`;},);/** * Log a trace message. */exportconsttrace=api({},async(data: Omit<LogContext,"level">)=>{// ^^^^^^^^^^^^^^^^^^^^^^^^^ HERE IS THE ERRORawaitlog({level: LogLevel.trace, ...data});},);/** * Log a debug message. */exportconstdebug=api({},async(data: Omit<LogContext,"level">)=>{// ^^^^^^^^^^^^^^^^^^^^^^^^^ HERE IS THE ERROR TOOawaitlog({level: LogLevel.debug, ...data});},);// ...other implementations
The error seems to go away pretending the log function with the following type alias and referencing it into the method signatures
// ...prior codetypeOmittedLogContext=Omit<LogContext,"level">;// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ THIS IS THE FIX (PART 1)exportconstlog=api({},// ...)// ...exportconsttrace=api({},async(data: OmittedLogContext)=>{// ^^^^^^^^^^^^^^^^^ THIS IS THE FIX (PART 2)awaitlog({level: LogLevel.trace, ...data});},);// ...other implementations
The text was updated successfully, but these errors were encountered:
Notice that no universe.ts exists in NPM nor as a Rust dependency. The only universe.ts I found is located here <current-repo-root>/tsparser/src/parser/universe.ts
As stated in the title a cryptic error arises when running
encore run
(W11 and Debian WSL tested).The following is the output from the command line.
the code snippet where the error resides is the following one:
The error seems to go away pretending the
log
function with the following type alias and referencing it into the method signaturesThe text was updated successfully, but these errors were encountered: