Skip to content

Commit

Permalink
Fix where we do the override
Browse files Browse the repository at this point in the history
  • Loading branch information
hamlim committed Mar 7, 2024
1 parent 3e810e6 commit 644be37
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Binary file modified recipes/nextjs-graphql-example/.jambox/default.tape.zip
Binary file not shown.
5 changes: 4 additions & 1 deletion recipes/nextjs-graphql-example/pages/server-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export default function ServerRenderPage({data: initialData}) {
</div>
<div>
{data ? (
<img src={data.pokemon.image} alt={data.pokemon.name} />
<>
<h2>{data.pokemon.name}</h2>
<img src={data.pokemon.image} alt={data.pokemon.name} />
</>
) : loading ? (
<p>Loading…</p>
) : (
Expand Down
9 changes: 0 additions & 9 deletions src/entrypoint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import launchServer from './server-launcher.mjs';
import Config from './Config.mjs';
import { parseArgs, JAMBOX_FLAGS } from './parse-args.mjs';
import { createDebug } from './diagnostics.js';
import * as Undici from 'undici';

const debug = createDebug();

Expand Down Expand Up @@ -63,14 +62,6 @@ export default async function cli(options) {
};
}

// Configure "native" `fetch` (e.g. `globalThis.fetch` in Node.js)
// to work with the `global-agent` proxy
// @see: https://github.com/gajus/global-agent/issues/52#issuecomment-1134525621
const ProxyAgent = Undici.ProxyAgent;
const setGlobalDispatcher = Undici.setGlobalDispatcher;

setGlobalDispatcher(new ProxyAgent(info.proxy.http));

// Launch a (node) script
spawn(entrypoint, args, {
cwd,
Expand Down
10 changes: 10 additions & 0 deletions src/script-helper.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
const undici = require('undici');
const globalAgent = require('global-agent');

globalAgent.bootstrap();

// Configure "native" `fetch` (e.g. `globalThis.fetch` in Node.js)
// to work with the `global-agent` proxy
// @see: https://github.com/gajus/global-agent/issues/52#issuecomment-1134525621
const ProxyAgent = undici.ProxyAgent;
const setGlobalDispatcher = undici.setGlobalDispatcher;

setGlobalDispatcher(new ProxyAgent(process.env.GLOBAL_AGENT_HTTP_PROXY));

0 comments on commit 644be37

Please sign in to comment.