AirmanEpic
AirmanEpic2d ago

Next throwing an error that seems to be "Deno not defined"

Weird issue here, but I'm probably misusing the client/server functions somewhere. Anyway, I have this function "getScores"
"use server"

import config from '../config.json' with { type: "json" };

export async function getScores(){
let scoresPath = `${config.folder}/scores.hth`;
let scores:{[fileName:string]:number} = {};
try{
let data = await Deno.readTextFile(scoresPath);
scores = JSON.parse(data);
}
catch(err){
console.log("13")
console.error("Error in scores file: ", err)
throw new Error("Error reading scores file");
}
return {scores: scores, path: config.folder};
}
"use server"

import config from '../config.json' with { type: "json" };

export async function getScores(){
let scoresPath = `${config.folder}/scores.hth`;
let scores:{[fileName:string]:number} = {};
try{
let data = await Deno.readTextFile(scoresPath);
scores = JSON.parse(data);
}
catch(err){
console.log("13")
console.error("Error in scores file: ", err)
throw new Error("Error reading scores file");
}
return {scores: scores, path: config.folder};
}
and seems to perform alright the first time it's called. However, my code calls for a reload, and getScores happens after the reload. This causes the nextjs process to actually crash, which I've never seen before. The errors:
1 Reply
AirmanEpic
AirmanEpicOP2d ago
GET /score 500 in 17628ms
⨯ Failed to handle request for /__nextjs_original-stack-frame?isServer=true&isEdgeServer=false&isAppDirectory=false&errorMessage=Error%3A+Module+not+found%3A+Can%27t+resolve+%27Deno%27%0A%0Ahttps%3A%2F%2Fnextjs.org%2Fdocs%2Fmessages%2Fmodule-not-found%0A%0AImport+trace+for+requested+module%3A%0A.%2Fsrc%2Fapp%2FheadToHead.ts%0A.%2Fsrc%2Fapp%2Fscore%2Fpage.tsx&file=file%3A%2F%2FD%3A%5CDocs%5CPortfolio_2%5CWebsite_Building%5CHeadToHead%5Chead-to-head%5Cnode_modules%5C.deno%5Cnext%4015.0.2%5Cnode_modules%5Cnext%5Cdist%5Cbuild%5Cwebpack%5Cplugins%5Cwellknown-errors-plugin%5CparseNotFoundError.js&methodName=getNotFoundError&arguments=&lineNumber=133&column=16
⨯ Failed to handle request for /__nextjs_original-stack-frame?isServer=true&isEdgeServer=false&isAppDirectory=false&errorMessage=Error%3A+Module+not+found%3A+Can%27t+resolve+%27Deno%27%0A%0Ahttps%3A%2F%2Fnextjs.org%2Fdocs%2Fmessages%2Fmodule-not-found%0A%0AImport+trace+for+requested+module%3A%0A.%2Fsrc%2Fapp%2FheadToHead.ts%0A.%2Fsrc%2Fapp%2Fscore%2Fpage.tsx&file=file%3A%2F%2FD%3A%5CDocs%5CPortfolio_2%5CWebsite_Building%5CHeadToHead%5Chead-to-head%5Cnode_modules%5C.deno%5Cnext%4015.0.2%5Cnode_modules%5Cnext%5Cdist%5Cbuild%5Cwebpack%5Cplugins%5Cwellknown-errors-plugin%5CwebpackModuleError.js&methodName=async+getModuleBuildError&arguments=&lineNumber=104&column=27
error: Uncaught TypeError: (0 , _module.findSourceMap) is not a function
GET /score 500 in 17628ms
⨯ Failed to handle request for /__nextjs_original-stack-frame?isServer=true&isEdgeServer=false&isAppDirectory=false&errorMessage=Error%3A+Module+not+found%3A+Can%27t+resolve+%27Deno%27%0A%0Ahttps%3A%2F%2Fnextjs.org%2Fdocs%2Fmessages%2Fmodule-not-found%0A%0AImport+trace+for+requested+module%3A%0A.%2Fsrc%2Fapp%2FheadToHead.ts%0A.%2Fsrc%2Fapp%2Fscore%2Fpage.tsx&file=file%3A%2F%2FD%3A%5CDocs%5CPortfolio_2%5CWebsite_Building%5CHeadToHead%5Chead-to-head%5Cnode_modules%5C.deno%5Cnext%4015.0.2%5Cnode_modules%5Cnext%5Cdist%5Cbuild%5Cwebpack%5Cplugins%5Cwellknown-errors-plugin%5CparseNotFoundError.js&methodName=getNotFoundError&arguments=&lineNumber=133&column=16
⨯ Failed to handle request for /__nextjs_original-stack-frame?isServer=true&isEdgeServer=false&isAppDirectory=false&errorMessage=Error%3A+Module+not+found%3A+Can%27t+resolve+%27Deno%27%0A%0Ahttps%3A%2F%2Fnextjs.org%2Fdocs%2Fmessages%2Fmodule-not-found%0A%0AImport+trace+for+requested+module%3A%0A.%2Fsrc%2Fapp%2FheadToHead.ts%0A.%2Fsrc%2Fapp%2Fscore%2Fpage.tsx&file=file%3A%2F%2FD%3A%5CDocs%5CPortfolio_2%5CWebsite_Building%5CHeadToHead%5Chead-to-head%5Cnode_modules%5C.deno%5Cnext%4015.0.2%5Cnode_modules%5Cnext%5Cdist%5Cbuild%5Cwebpack%5Cplugins%5Cwellknown-errors-plugin%5CwebpackModuleError.js&methodName=async+getModuleBuildError&arguments=&lineNumber=104&column=27
error: Uncaught TypeError: (0 , _module.findSourceMap) is not a function