Hardcode recorder API endpoints in build and runtime

This commit is contained in:
Mike Cao
2026-06-15 14:50:13 -07:00
parent 15038b09d9
commit a5f78e3e3d
2 changed files with 2 additions and 5 deletions
-3
View File
@@ -15,9 +15,6 @@ export default {
commonjs(), commonjs(),
replace({ replace({
__COLLECT_API_HOST__: process.env.COLLECT_API_HOST || '', __COLLECT_API_HOST__: process.env.COLLECT_API_HOST || '',
__COLLECT_REPLAY_ENDPOINT__: process.env.COLLECT_REPLAY_ENDPOINT || '/api/record',
__RECORDER_CONFIG_ENDPOINT__:
process.env.RECORDER_CONFIG_ENDPOINT || '/api/websites/{websiteId}/recorder',
delimiters: ['', ''], delimiters: ['', ''],
preventAssignment: true, preventAssignment: true,
}), }),
+2 -2
View File
@@ -18,8 +18,8 @@ import { record } from 'rrweb';
const host = const host =
hostUrl || '__COLLECT_API_HOST__' || currentScript.src.split('/').slice(0, -1).join('/'); hostUrl || '__COLLECT_API_HOST__' || currentScript.src.split('/').slice(0, -1).join('/');
const hostBase = host.replace(/\/$/, ''); const hostBase = host.replace(/\/$/, '');
const endpoint = `${hostBase}__COLLECT_REPLAY_ENDPOINT__`; const endpoint = `${hostBase}/api/record`;
const configEndpoint = `${hostBase}__RECORDER_CONFIG_ENDPOINT__`.replace('{websiteId}', website); const configEndpoint = `${hostBase}/api/websites/${website}/recorder`;
const REPLAY_FLUSH_EVENT_COUNT = 100; const REPLAY_FLUSH_EVENT_COUNT = 100;
const REPLAY_FLUSH_INTERVAL = 2000; const REPLAY_FLUSH_INTERVAL = 2000;