Skip to content

Commit 0db5783

Browse files
committed
fix(app): resolve issue with dirname resolution fallback to process.cwd()
1 parent 80954a8 commit 0db5783

File tree

1 file changed

+6
-2
lines changed
  • packages/auth-services/src/login-server/src

1 file changed

+6
-2
lines changed

packages/auth-services/src/login-server/src/app.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import express, { Express } from 'express';
22
import cors from 'cors';
33
import { OAuth2Client } from 'google-auth-library';
44
import path from 'node:path';
5-
import { fileURLToPath } from 'node:url';
5+
66
// Prefer Node's CJS globals when available; fallback to process.cwd()
7-
const resolvedDirname = path.dirname(fileURLToPath(import.meta.url));
7+
// Note: Tried to use "import { fileURLToPath } from 'node:url';", but got the following error:
8+
// TypeError: The "path" argument must be of type string or an instance of URL. Received undefined
9+
// at fileURLToPath (node:internal/url:1606:11)
10+
// at Object.<anonymous> (/Users/js-sdk/dist/apps/lit-auth-server/main.cjs:490211:90)
11+
const resolvedDirname = typeof __dirname !== 'undefined' ? __dirname : process.cwd();
812

913
type DiscordTokenResponse = {
1014
access_token?: string;

0 commit comments

Comments
 (0)