DenoDDeno
Powered by
AirmanEpicA
Denoβ€’17mo agoβ€’
1 reply
AirmanEpic

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:
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

deno runtime extensions seems to be not working
AV6AAV6 / help
3y ago
Deno is not defined
jsJjs / help
2y ago
`@sentry/node` is throwing an export error on Deno Deploy
Nissan AhmedNNissan Ahmed / help
3y ago
mkdirsync is throwing an exception that can't be caught?
StokestackSStokestack / help
2y ago