Skip to content

Commit

Permalink
fix: monitor script update failing
Browse files Browse the repository at this point in the history
  • Loading branch information
rofe committed Nov 8, 2023
1 parent 5a5047b commit 6072f5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/newrelic/synthetics.js
Expand Up @@ -11,7 +11,7 @@
*/
import { h1 } from '@adobe/fetch';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const { fetch } = h1();
export const MONITOR_FREQUENCY = 15;
Expand Down Expand Up @@ -105,8 +105,9 @@ async function updateMonitor(auth, monitor, url, script, locations, frequency) {

console.log('Updating script for monitor', monitor.name);

const defaultScript = fileURLToPath(new URL('./monitor_script.js', import.meta.url));
const scriptText = Buffer.from(fs
.readFileSync(script || path.resolve(__rootdir, 'src', 'newrelic', 'monitor_script.js'))
.readFileSync(script || defaultScript)
.toString()
.replace('$$$URL$$$', url)
.replace('$$$NS$$$', getNS(url)))
Expand Down

0 comments on commit 6072f5c

Please sign in to comment.