Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Align apollo-server config with state of embeds #7432

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/kind-yaks-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@apollo/server': patch
---

Bug fix: tldr revert a previous change that stops passing includeCookies from the prod landing page config.

Who was affected?

Any Apollo Server instance that passes a `graphRef` to a production landing page with a non-default `includeCookies` value that does not match the `Include cookies` setting on your registered variant on studio.apollographql.com.

How were they affected?

From release 4.4.0 to this patch release, folks affected would have seen their Explorer requests being sent with cookies included only if they had set `Include cookies` on their variant. Cookies would not havhe been included by default.
mayakoneval marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
</script>
<script>
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"includeCookies":true,"document":"query Test { id }","variables":{"option":{"a":"val","b":1,"c":true}},"headers":{"authorization":"true"},"embed":{"displayOptions":{"showHeadersAndEnvVars":true,"docsPanelState":"open","theme":"light"},"persistExplorerState":true},"graphRef":"graph@current","displayOptions":{"showHeadersAndEnvVars":true,"docsPanelState":"open","theme":"light"}},"persistExplorerState":true,"hideCookieToggle":false};
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"document":"query Test { id }","headers":{"authorization":"true"},"variables":{"option":{"a":"val","b":1,"c":true}},"displayOptions":{"showHeadersAndEnvVars":true,"docsPanelState":"open","theme":"light"}},"persistExplorerState":true,"includeCookies":true};
new window.EmbeddedExplorer({
...embeddedExplorerConfig,
endpointUrl,
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
</script>
<script>
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"includeCookies":false,"embed":true,"graphRef":"graph@current","displayOptions":{}},"persistExplorerState":false,"hideCookieToggle":false};
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"displayOptions":{}},"persistExplorerState":false,"includeCookies":false};
new window.EmbeddedExplorer({
...embeddedExplorerConfig,
endpointUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getEmbeddedExplorerHTML = (

endpointUrl: string;

hideCookieToggle?: boolean; // defaults to 'true'
includeCookies?: boolean; // defaults to 'false'
}
const productionLandingPageConfigOrDefault = {
displayOptions: {},
Expand All @@ -54,14 +54,16 @@ export const getEmbeddedExplorerHTML = (
graphRef: config.graphRef,
target: '#embeddableExplorer',
initialState: {
...config,
document: config.document,
headers: config.headers,
variables: config.variables,
displayOptions: {
...productionLandingPageConfigOrDefault.displayOptions,
},
},
persistExplorerState:
productionLandingPageConfigOrDefault.persistExplorerState,
hideCookieToggle: false,
includeCookies: config.includeCookies,
};

return `
Expand Down Expand Up @@ -117,10 +119,10 @@ id="embeddableSandbox"
target: '#embeddableSandbox',
initialEndpoint,
initialState: ${getConfigStringForHtml({
document: config.document ?? undefined,
variables: config.variables ?? undefined,
headers: config.headers ?? undefined,
includeCookies: config.includeCookies ?? undefined,
document: config.document,
variables: config.variables,
headers: config.headers,
includeCookies: config.includeCookies,
})},
hideCookieToggle: false,
});
Expand Down