SuperTokens is officialy not compatible with Deno,...
# support-questions-legacy
l
SuperTokens is officialy not compatible with Deno, right? Now that Deno added support for npm packages, im wondering: Did anyone get Supertokens to work with deno?
r
i think it should work! But we don't yet work with the deno fresh webserver
l
Okay. I am using Deno with the npm express package anyways
So the express middleware should work... Thanks for the fast reply :)
r
yea it should
l
Everything except the dashboard works
The dashboard uses crypto.getcurves (in a dependency if I'm not wrong) which is not supported in deno
r
hmm. That's odd. We don't really use anything with that lib on the dashboard.
perhaps @nkshah2 can help
n
Hi @Lionel , Like rp mentioned we dont use the crypto package in any way. Did you get any error that pointed you to
crypto.getcurves
?
r
and can we see the stack trace?
l
Hi! I'm not home right now, but I will send you the stack trace later. I will also double-check if it's really from one of your dependencies... :)
Here is the stack trace...

https://cdn.discordapp.com/attachments/1100093722655465564/1100457972120944709/image.png

The .cache/deno folder is where deno caches all the npm packages you use, I didn't tweak anything there...
Looks like you (or any of your dependencies) use "jose" which uses Crypto.getCurves
Which is not (yet) supported by deno
Without the dashboard its working fine
But as soon as i load the npm package (your dashboard) import Dashboard from "npm:supertokens-node@latest/recipe/dashboard/index.js"; and do Dashboard.init(), this error comes up (even before i load up the dasboard url)
r
Hmm. I see. @nkshah2 can look into this perhaps.
n
Hey @Lionel , Out of curiosity, what recipes are you using?
l
Sorry, i didn't see the message
Ill check now
Here is the whole file:
Copy code
ts
// deno-lint-ignore-file no-explicit-any
import express from "npm:express@latest";
import supertokens from "npm:supertokens-node@latest"
import Session from "npm:supertokens-node@latest/recipe/session/index.js";
import Passwordless from "npm:supertokens-node@latest/recipe/passwordless/index.js";
import cors from "npm:cors@latest";
import {middleware} from "npm:supertokens-node@latest/framework/express/index.js";
import {errorHandler} from "npm:supertokens-node@latest/framework/express/index.js";
import { verifySession } from "npm:supertokens-node@latest/recipe/session/framework/express/index.js";
import { SessionRequest } from "npm:supertokens-node@latest/framework/express/index.js";
import Dashboard from "npm:supertokens-node@latest/recipe/dashboard/index.js";
const app = express();


supertokens.init({
    framework: "express",
    supertokens: {
        connectionURI: "x",
        apiKey: "x",
    },
    appInfo: {
        appName: "L-test-space",
        apiDomain: "http://localhost:8080",
        websiteDomain: "http://localhost:3000",
        apiBasePath: "/auth",
        websiteBasePath: "/auth"
    },
    recipeList: [
        Passwordless.init({
            flowType: "USER_INPUT_CODE_AND_MAGIC_LINK",
            contactMethod: "EMAIL"
        }),
        Dashboard.init(),
        Session.init()
    ]
});

app.use(cors({
  origin: "http://localhost:3000",
  allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
  credentials: true,
}));
app.use(middleware());

app.get("/", verifySession(), (_req:SessionRequest, res: any) => {
  res.send("Welcome to the Dinosaur API!");
});

app.get('/login',function(_req: any,res: any) {
  res.sendFile('login.html', {root: 'public'});
});

app.use('/scripts', express.static('scripts'))

app.use(errorHandler())

app.listen(8080, () => {
  console.log("Running ✅")
});
Maybe i did something wrong
Its Typescript and using the Deno runtime...
On the import statements in deno: npm: just indicates its an npm package (ignore it) @latest: Uses the latest available version of the package /index.js (in the end): Is necessary, because deno doesn't automaticly run the index.js file...
@nkshah2 If you need any more information, just tag me..
I removed a few things, so the lines from the stack trace might not match... I can't send such big text message.. If you need the original file, let me know, and ill upload it
r
@nkshah2 ^ please see.
n
Hey @Lionel, Thanks for the info, can you try using the third party recipe without using the dashboard recipe? (Remove the imports and any code related to the dashboard) Just trying to rule things out
l
Okay

https://cdn.discordapp.com/attachments/1100093722655465564/1101922232869076992/image.png

test.ts is the thirdparty recipe file
So not, it doesn't work either
Some Dependency is using this "jose" npm package which uses this crypto.getCurves
🤔
Which makes it incompatible with Deno
If you need anymore tests, let me know @nkshah2
:)
n
Right so at the moment the node sdk won’t work with Deno unfortunately. You can open an issue about this and we can look into adding support for this in the future
l
Okay.
I will just not use the Dashboard for now.
Thank you very much for your help tho!
20 Views