stack icon indicating copy to clipboard operation
stack copied to clipboard

Error [ERR_UNSUPPORTED_DIR_IMPORT]

Open firstaxel opened this issue 9 months ago • 2 comments

I was trying to use Stack-auth js in one of my api using encore.ts but this error below keeps happening

my code is


import { StackServerApp } from '@stackframe/js';

import { secret } from 'encore.dev/config';

const projectId = secret('stackProjectId');
const stackSecretKey = secret('stackSecretKey');
const stackPublishableKey = secret('stackPublishableKey');

export const authServer = new StackServerApp({
  projectId: projectId(),
  publishableClientKey: stackPublishableKey(),
  secretServerKey: stackSecretKey(),
  tokenStore: 'memory',
});

i am getting that stackauth js does not allow esm imports

Error gotten


node:internal/modules/esm/resolve:263
    throw new ERR_UNSUPPORTED_DIR_IMPORT(path, basePath, String(resolved));
          ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/home/olasubomi/Documents/real_project/web3/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@[email protected]_ef45e2b6268d8d4dadbea61fccc4a00d/node_modules/@stackframe/js/dist/esm/lib/stack-app' is not supported resolving ES modules imported from /home/olasubomi/Documents/real_project/web3/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@[email protected]_ef45e2b6268d8d4dadbea61fccc4a00d/node_modules/@stackframe/js/dist/esm/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:263:11)
    at moduleResolve (node:internal/modules/esm/resolve:860:10)
    at defaultResolve (node:internal/modules/esm/resolve:984:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:719:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:643:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:626:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:279:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:136:49) {
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file:///home/olasubomi/Documents/real_project/web3/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@[email protected]_ef45e2b6268d8d4dadbea61fccc4a00d/node_modules/@stackframe/js/dist/esm/lib/stack-app'
}

Node.js v23.7.0

firstaxel avatar Mar 17 '25 15:03 firstaxel

Any updates on this issue? Did you manage to fix it?

juanmartin8a avatar Apr 13 '25 03:04 juanmartin8a

Should be fixed in #677

fomalhautb avatar May 13 '25 22:05 fomalhautb