Skip to content

Commit

Permalink
fix: use allow-net flag to run config function (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Oct 3, 2022
1 parent dc93a27 commit 57d0edb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions deno/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ let func

try {
func = await import(functionURL)
} catch {
} catch (error) {
console.error(error)

Deno.exit(exitCodes.ImportError)
}

Expand All @@ -31,7 +33,9 @@ try {
const result = JSON.stringify(config)

await Deno.writeTextFile(new URL(collectorURL), result)
} catch {
} catch (error) {
console.error(error)

Deno.exit(exitCodes.SerializationError)
}

Expand Down
3 changes: 2 additions & 1 deletion node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const getFunctionConfig = async (func: EdgeFunction, deno: DenoBridge, lo
const { exitCode, stderr, stdout } = await deno.run(
[
'run',
'--allow-net',
'--allow-read',
`--allow-write=${collector.path}`,
'--quiet',
Expand Down Expand Up @@ -87,7 +88,7 @@ const logConfigError = (func: EdgeFunction, exitCode: number, stderr: string, lo
switch (exitCode) {
case ConfigExitCode.ImportError:
log.user(`Could not load edge function at '${func.path}'`)
log.system(stderr)
log.user(stderr)

break

Expand Down

0 comments on commit 57d0edb

Please sign in to comment.