Skip to content

Commit 573b913

Browse files
authored
feat(graph): populate graph token for ISR (#1525)
* feat(graph): populate graph token in odb * feat(graph): simplify * chore(graph): set env var before the launcher * chore(graph): update functions dep * undo whitespace change
1 parent 8a98d72 commit 573b913

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/runtime/src/templates/getHandler.ts

+8
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ const makeHandler = (conf: NextConfig, app, pageRoot, staticManifest: Array<[str
101101
const query = new URLSearchParams(event.queryStringParameters).toString()
102102
event.path = query ? `${event.path}?${query}` : event.path
103103

104+
const graphToken = event.netlifyGraphToken
105+
if (graphToken && requestMode !== 'ssr') {
106+
// Prefix with underscore to help us determine the origin of the token
107+
// allows us to write better error messages
108+
// eslint-disable-next-line no-underscore-dangle
109+
process.env._NETLIFY_GRAPH_TOKEN = graphToken
110+
}
111+
104112
const { headers, ...result } = await getBridge(event).launcher(event, context)
105113

106114
// Convert all headers to multiValueHeaders

0 commit comments

Comments
 (0)