Skip to content

Commit 607e81a

Browse files
committed
ci: server-entry fix Refs: PL-240
1 parent 0a5b2d6 commit 607e81a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { execSync } from 'child_process'
22

33
export const getGitTag = () => {
44
try {
5-
return execSync('git describe --abbrev=0 --tags', { cwd: '.' })
5+
return execSync('git describe --abbrev=0 --tags', { cwd: '.', stdio: 'pipe' })
66
.toString()
77
.replace(/\r?\n|\r/g, '')
88
} catch (error) {
@@ -12,7 +12,7 @@ export const getGitTag = () => {
1212

1313
export const getGitCommit = () => {
1414
try {
15-
return execSync('git rev-parse --short HEAD', { cwd: '.' })
15+
return execSync('git rev-parse --short HEAD', { cwd: '.', stdio: 'pipe' })
1616
.toString()
1717
.trim()
1818
} catch (error) {

server.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ import { sharedIgnoreErrors } from './config/sentry.js';
1919
import { getGitCommit, getGitTag } from './scripts/utils.js';
2020

2121
const __dirname = path.dirname(fileURLToPath(import.meta.url));
22-
const isProd = process.env.NODE_ENV === 'production';
22+
23+
// Detect production mode by the presence of the pre-built SSR entry point rather than
24+
// relying on NODE_ENV alone. Review/staging environments may set NODE_ENV to a
25+
// non-"production" value (e.g. "staging") while still running the production image,
26+
// which does not include src/ and cannot serve via Vite dev middleware.
27+
const builtEntryPath = path.join(__dirname, 'dist/server/server-entry.mjs');
28+
const isProd = fs.existsSync(builtEntryPath);
2329

2430
const GIT_TAG = getGitTag();
2531
const GIT_COMMIT = getGitCommit();

0 commit comments

Comments
 (0)