From 5cc1d154b820164117a4ae7623ab6a2367be31b0 Mon Sep 17 00:00:00 2001 From: Liz Kenyon Date: Mon, 9 Dec 2024 15:45:28 -0600 Subject: [PATCH 1/3] Revert "Revert "Add Shop context to logs"" --- .../server/authenticate/admin/authenticate.ts | 23 ++++++++++++++----- .../authenticate/admin/billing/helpers.ts | 2 +- .../admin/helpers/handle-client-error.ts | 2 ++ .../authenticate/admin/helpers/redirect.ts | 2 +- .../admin/helpers/trigger-after-auth-hook.ts | 2 +- .../helpers/validate-shop-and-host-params.ts | 1 + .../admin/strategies/auth-code-flow.ts | 8 ++++--- .../admin/strategies/merchant-custom-app.ts | 8 +++++-- .../admin/strategies/token-exchange.ts | 11 +++++---- .../__tests__/get-shop-from-request.test.ts | 15 ++++++++++++ .../helpers/create-or-load-offline-session.ts | 6 +++-- .../helpers/get-shop-from-request.ts | 4 ++++ .../src/server/authenticate/helpers/index.ts | 1 + .../helpers/invalidate-access-token.ts | 4 +++- .../helpers/validate-session-token.ts | 12 +++++++--- .../public/appProxy/authenticate.ts | 10 ++++---- .../public/extension/authenticate.ts | 9 ++++++-- 17 files changed, 89 insertions(+), 31 deletions(-) create mode 100644 packages/apps/shopify-app-remix/src/server/authenticate/helpers/__tests__/get-shop-from-request.test.ts create mode 100644 packages/apps/shopify-app-remix/src/server/authenticate/helpers/get-shop-from-request.ts diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/authenticate.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/authenticate.ts index 20737415a6..11b05a810c 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/authenticate.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/authenticate.ts @@ -9,6 +9,7 @@ import { respondToBotRequest, respondToOptionsRequest, validateSessionToken, + getShopFromRequest, } from '../helpers'; import { @@ -60,7 +61,9 @@ export function authStrategyFactory< const url = new URL(request.url); if (url.pathname === config.auth.patchSessionTokenPath) { - logger.debug('Rendering bounce page'); + logger.debug('Rendering bounce page', { + shop: getShopFromRequest(request), + }); throw renderAppBridge({config, logger, api}, request); } } @@ -71,7 +74,10 @@ export function authStrategyFactory< if (url.pathname === config.auth.exitIframePath) { const destination = url.searchParams.get('exitIframe')!; - logger.debug('Rendering exit iframe page', {destination}); + logger.debug('Rendering exit iframe page', { + shop: getShopFromRequest(request), + destination, + }); throw renderAppBridge({config, logger, api}, request, {url: destination}); } } @@ -154,12 +160,14 @@ export function authStrategyFactory< await ensureSessionTokenSearchParamIfRequired(params, request); } - logger.info('Authenticating admin request'); + logger.info('Authenticating admin request', { + shop: getShopFromRequest(request), + }); const {payload, shop, sessionId, sessionToken} = await getSessionTokenContext(params, request); - logger.debug('Loading session from storage', {sessionId}); + logger.debug('Loading session from storage', {shop, sessionId}); const existingSession = sessionId ? await config.sessionStorage!.loadSession(sessionId) : undefined; @@ -173,7 +181,9 @@ export function authStrategyFactory< return createContext(request, session, strategy, payload); } catch (errorOrResponse) { if (errorOrResponse instanceof Response) { - logger.debug('Authenticate returned a response'); + logger.debug('Authenticate returned a response', { + shop: getShopFromRequest(request), + }); ensureCORSHeadersFactory(params, request)(errorOrResponse); } @@ -193,6 +203,7 @@ async function getSessionTokenContext( const sessionToken = (headerSessionToken || searchParamSessionToken)!; logger.debug('Attempting to authenticate session token', { + shop: getShopFromRequest(request), sessionToken: JSON.stringify({ header: headerSessionToken, search: searchParamSessionToken, @@ -204,7 +215,7 @@ async function getSessionTokenContext( const dest = new URL(payload.dest); const shop = dest.hostname; - logger.debug('Session token is valid', {shop, payload}); + logger.debug('Session token is valid - authenticated', {shop, payload}); const sessionId = config.useOnlineTokens ? api.session.getJwtSessionId(shop, payload.sub) : api.session.getOfflineId(shop); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/billing/helpers.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/billing/helpers.ts index ca137c530a..3b234aef7e 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/billing/helpers.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/billing/helpers.ts @@ -11,7 +11,7 @@ export function redirectOutOfApp( ): never { const {config, logger} = params; - logger.debug('Redirecting out of app', {url}); + logger.debug('Redirecting out of app', {shop, url}); const requestUrl = new URL(request.url); const isEmbeddedRequest = requestUrl.searchParams.get('embedded') === '1'; diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/handle-client-error.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/handle-client-error.ts index fda47f8092..c9d22f1721 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/handle-client-error.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/handle-client-error.ts @@ -15,6 +15,7 @@ export function handleClientErrorFactory({ if (error instanceof HttpResponseError !== true) { params.logger.debug( `Got a response error from the API: ${error.message}`, + {shop: session.shop}, ); throw error; } @@ -22,6 +23,7 @@ export function handleClientErrorFactory({ params.logger.debug( `Got an HTTP response error from the API: ${error.message}`, { + shop: session.shop, code: error.response.code, statusText: error.response.statusText, body: JSON.stringify(error.response.body), diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/redirect.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/redirect.ts index a8b5ca9a1a..8cdb1964cc 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/redirect.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/redirect.ts @@ -46,7 +46,7 @@ export function redirectFactory( init, }); - logger.debug('Redirecting', {url: parsedUrl.toString()}); + logger.debug('Redirecting', {shop, url: parsedUrl.toString()}); const isSameOrigin = parsedUrl.origin === config.appUrl; if (isSameOrigin || url.startsWith('/')) { diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts index 95f0b62a73..f8ff7c701c 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts @@ -18,7 +18,7 @@ export async function triggerAfterAuthHook< ) { const {config, logger} = params; if (config.hooks.afterAuth) { - logger.info('Running afterAuth hook'); + logger.info('Running afterAuth hook', {shop: session.shop}); const admin = createAdminApiContext( session, diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts index 2772d8f190..31f41e38c2 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts @@ -21,6 +21,7 @@ export function validateShopAndHostParams( const host = api.utils.sanitizeHost(url.searchParams.get('host')!); if (!host) { logger.debug('Invalid host, redirecting to login path', { + shop, host: url.searchParams.get('host'), }); throw redirectToLoginPath(request, params); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts index fb5bf9f6ae..55d9ff7746 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts @@ -190,7 +190,7 @@ export class AuthCodeFlowStrategy< ): Promise { const {api, config, logger} = this; - logger.info('Handling OAuth callback request'); + logger.info('Handling OAuth callback request', {shop}); try { const {session, headers: responseHeaders} = await api.auth.callback({ @@ -200,7 +200,9 @@ export class AuthCodeFlowStrategy< await config.sessionStorage!.storeSession(session); if (config.useOnlineTokens && !session.isOnline) { - logger.info('Requesting online access token for offline session'); + logger.info('Requesting online access token for offline session', { + shop, + }); await beginAuth({api, config, logger}, request, true, shop); } @@ -273,7 +275,7 @@ export class AuthCodeFlowStrategy< shop: string, ) { const {logger} = this; - logger.error('Error during OAuth callback', {error: error.message}); + logger.error('Error during OAuth callback', {shop, error: error.message}); if (error instanceof CookieNotFound) { return this.handleAuthBeginRequest(request, shop); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/merchant-custom-app.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/merchant-custom-app.ts index 9d0785ccab..d229759c00 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/merchant-custom-app.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/merchant-custom-app.ts @@ -10,6 +10,7 @@ import {BasicParams} from '../../../types'; import {ApiConfigWithFutureFlags, ApiFutureFlags} from '../../../future/flags'; import {HandleAdminClientError} from '../../../clients'; import {handleClientErrorFactory} from '../helpers'; +import {getShopFromRequest} from '../../helpers'; import {AuthorizationStrategy, OnErrorOptions, SessionContext} from './types'; @@ -31,8 +32,10 @@ export class MerchantCustomAuth this.logger = logger; } - public async respondToOAuthRequests(_request: Request): Promise { - this.logger.debug('Skipping OAuth request for merchant custom app'); + public async respondToOAuthRequests(request: Request): Promise { + this.logger.debug('Skipping OAuth request for merchant custom app', { + shop: getShopFromRequest(request), + }); } public async authenticate( @@ -43,6 +46,7 @@ export class MerchantCustomAuth this.logger.debug( 'Building session from configured access token for merchant custom app', + {shop}, ); const session = this.api.session.customAppSession(shop); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/token-exchange.ts b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/token-exchange.ts index 551eb96219..ab190e4a4b 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/token-exchange.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/admin/strategies/token-exchange.ts @@ -12,6 +12,7 @@ import {BasicParams} from '../../../types'; import { respondToInvalidSessionToken, invalidateAccessToken, + getShopFromRequest, } from '../../helpers'; import {handleClientErrorFactory, triggerAfterAuthHook} from '../helpers'; import {HandleAdminClientError} from '../../../clients'; @@ -52,8 +53,8 @@ export class TokenExchangeStrategy if (!sessionToken) throw new InvalidJwtError(); if (!session || !session.isActive(undefined)) { - logger.info('No valid session found'); - logger.info('Requesting offline access token'); + logger.info('No valid session found', {shop}); + logger.info('Requesting offline access token', {shop}); const {session: offlineSession} = await this.exchangeToken({ request, sessionToken, @@ -66,7 +67,7 @@ export class TokenExchangeStrategy let newSession = offlineSession; if (config.useOnlineTokens) { - logger.info('Requesting online access token'); + logger.info('Requesting online access token', {shop}); const {session: onlineSession} = await this.exchangeToken({ request, sessionToken, @@ -113,7 +114,9 @@ export class TokenExchangeStrategy request, onError: async ({session, error}: OnErrorOptions) => { if (error.response.code === 401) { - logger.debug('Responding to invalid access token'); + logger.debug('Responding to invalid access token', { + shop: getShopFromRequest(request), + }); await invalidateAccessToken({config, api, logger}, session); respondToInvalidSessionToken({ diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/__tests__/get-shop-from-request.test.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/__tests__/get-shop-from-request.test.ts new file mode 100644 index 0000000000..ffe1208977 --- /dev/null +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/__tests__/get-shop-from-request.test.ts @@ -0,0 +1,15 @@ +import {APP_URL, TEST_SHOP} from '../../../__test-helpers'; +import {getShopFromRequest} from '../get-shop-from-request'; + +describe('getShopFromRequest', () => { + it('returns sanitized shop domain from request URL params', () => { + // GIVEN + const request = new Request(`${APP_URL}?shop=${TEST_SHOP}`); + + // WHEN + const result = getShopFromRequest(request); + + // THEN + expect(result).toBe(TEST_SHOP); + }); +}); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/create-or-load-offline-session.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/create-or-load-offline-session.ts index 0c52613b30..8ba2d399dd 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/create-or-load-offline-session.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/create-or-load-offline-session.ts @@ -5,10 +5,12 @@ export async function createOrLoadOfflineSession( {api, config, logger}: BasicParams, ) { if (config.distribution === AppDistribution.ShopifyAdmin) { - logger.debug('Creating custom app session from configured access token'); + logger.debug('Creating custom app session from configured access token', { + shop, + }); return api.session.customAppSession(shop); } else { - logger.debug('Loading offline session from session storage'); + logger.debug('Loading offline session from session storage', {shop}); const offlineSessionId = api.session.getOfflineId(shop); const session = await config.sessionStorage!.loadSession(offlineSessionId); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/get-shop-from-request.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/get-shop-from-request.ts new file mode 100644 index 0000000000..3da97cf12a --- /dev/null +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/get-shop-from-request.ts @@ -0,0 +1,4 @@ +export function getShopFromRequest(request: Request) { + const url = new URL(request.url); + return url.searchParams.get('shop')!; +} diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/index.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/index.ts index a84fcafb29..a7b3677e45 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/index.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/index.ts @@ -8,3 +8,4 @@ export * from './reject-bot-request'; export * from './respond-to-options-request'; export * from './respond-to-invalid-session-token'; export * from './create-or-load-offline-session'; +export * from './get-shop-from-request'; diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/invalidate-access-token.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/invalidate-access-token.ts index d6d2b82d41..82ae17b3e4 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/invalidate-access-token.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/invalidate-access-token.ts @@ -8,7 +8,9 @@ export async function invalidateAccessToken( ): Promise { const {logger, config} = params; - logger.debug(`Invalidating access token for session - ${session.id}`); + logger.debug(`Invalidating access token for session - ${session.id}`, { + shop: session.shop, + }); session.accessToken = undefined; await config.sessionStorage!.storeSession(session); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts index 3c8e90551e..dcd73f8a71 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts @@ -3,6 +3,7 @@ import {JwtPayload} from '@shopify/shopify-api'; import type {BasicParams} from '../../types'; import {respondToInvalidSessionToken} from './respond-to-invalid-session-token'; +import {getShopFromRequest} from './get-shop-from-request'; interface ValidateSessionTokenOptions { checkAudience?: boolean; @@ -15,19 +16,24 @@ export async function validateSessionToken( {checkAudience = true}: ValidateSessionTokenOptions = {}, ): Promise { const {api, logger} = params; - logger.debug('Validating session token'); + logger.debug('Validating session token', {shop: getShopFromRequest(request)}); try { const payload = await api.session.decodeSessionToken(token, { checkAudience, }); - logger.debug('Session token is valid', { + const dest = new URL(payload.dest); + const shop = dest.hostname; + logger.debug('Session token is valid - validated', { + shop, payload: JSON.stringify(payload), }); return payload; } catch (error) { - logger.debug(`Failed to validate session token: ${error.message}`); + logger.debug(`Failed to validate session token: ${error.message}`, { + shop: getShopFromRequest(request), + }); throw respondToInvalidSessionToken({params, request, retryRequest: true}); } diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.ts b/packages/apps/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.ts index 6c24435e4e..e1c992f36f 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.ts @@ -22,19 +22,18 @@ export function authenticateAppProxyFactory< ): Promise< AppProxyContext | AppProxyContextWithSession > { - logger.info('Authenticating app proxy request'); - const url = new URL(request.url); + const shop = url.searchParams.get('shop')!; + logger.info('Authenticating app proxy request', {shop}); if (!(await validateAppProxyHmac(params, url))) { - logger.info('App proxy request has invalid signature'); + logger.info('App proxy request has invalid signature', {shop}); throw new Response(undefined, { status: 400, statusText: 'Bad Request', }); } - const shop = url.searchParams.get('shop')!; const sessionId = api.session.getOfflineId(shop); const session = await config.sessionStorage!.loadSession(sessionId); @@ -137,7 +136,8 @@ async function validateAppProxyHmac( return isValid; } catch (error) { - logger.info(error.message); + const shop = url.searchParams.get('shop')!; + logger.info(error.message, {shop}); throw new Response(undefined, {status: 400, statusText: 'Bad Request'}); } } diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/public/extension/authenticate.ts b/packages/apps/shopify-app-remix/src/server/authenticate/public/extension/authenticate.ts index 8d7d174b1a..ac90bb9269 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/public/extension/authenticate.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/public/extension/authenticate.ts @@ -5,6 +5,7 @@ import { getSessionTokenHeader, validateSessionToken, ensureCORSHeadersFactory, + getShopFromRequest, } from '../../helpers'; import {AuthenticateExtension, ExtensionContext} from './types'; @@ -26,10 +27,14 @@ export function authenticateExtensionFactory( const sessionTokenHeader = getSessionTokenHeader(request); - logger.info(`Authenticating ${requestType} request`); + logger.info(`Authenticating ${requestType} request`, { + shop: getShopFromRequest(request), + }); if (!sessionTokenHeader) { - logger.debug('Request did not contain a session token'); + logger.debug('Request did not contain a session token', { + shop: getShopFromRequest(request), + }); throw new Response(undefined, { status: 401, statusText: 'Unauthorized', From 1a861c67f6161d9248ddc9903e29c2a50643a229 Mon Sep 17 00:00:00 2001 From: Elizabeth Kenyon Date: Mon, 9 Dec 2024 16:01:53 -0600 Subject: [PATCH 2/3] Update logging from validate session token log just shop --- .../authenticate/helpers/validate-session-token.ts | 7 +++---- .../public/checkout/__tests__/authenticate.test.ts | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts index dcd73f8a71..3511d0ed15 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts @@ -16,14 +16,13 @@ export async function validateSessionToken( {checkAudience = true}: ValidateSessionTokenOptions = {}, ): Promise { const {api, logger} = params; - logger.debug('Validating session token', {shop: getShopFromRequest(request)}); + const shop = getShopFromRequest(request); + logger.debug('Validating session token', {shop}); try { const payload = await api.session.decodeSessionToken(token, { checkAudience, }); - const dest = new URL(payload.dest); - const shop = dest.hostname; logger.debug('Session token is valid - validated', { shop, payload: JSON.stringify(payload), @@ -32,7 +31,7 @@ export async function validateSessionToken( return payload; } catch (error) { logger.debug(`Failed to validate session token: ${error.message}`, { - shop: getShopFromRequest(request), + shop, }); throw respondToInvalidSessionToken({params, request, retryRequest: true}); diff --git a/packages/apps/shopify-app-remix/src/server/authenticate/public/checkout/__tests__/authenticate.test.ts b/packages/apps/shopify-app-remix/src/server/authenticate/public/checkout/__tests__/authenticate.test.ts index 267b34a7c5..00236b035b 100644 --- a/packages/apps/shopify-app-remix/src/server/authenticate/public/checkout/__tests__/authenticate.test.ts +++ b/packages/apps/shopify-app-remix/src/server/authenticate/public/checkout/__tests__/authenticate.test.ts @@ -10,7 +10,8 @@ describe('JWT validation', () => { it('returns token when successful', async () => { // GIVEN const shopify = shopifyApp(testConfig()); - const {token, payload} = getJwt(); + // Checkout UI session tokens don't include the protocol + const {token, payload} = getJwt({dest: 'test-shop.myshopify.com'}); // WHEN const {sessionToken} = await shopify.authenticate.public.checkout( @@ -28,7 +29,7 @@ describe('JWT validation', () => { it('sets extra CORS allowed headers when requested from a different origin', async () => { // GIVEN const shopify = shopifyApp(testConfig()); - const {token} = getJwt(); + const {token} = getJwt({dest: 'test-shop.myshopify.com'}); // WHEN const {cors} = await shopify.authenticate.public.checkout( @@ -51,7 +52,7 @@ describe('JWT validation', () => { it('responds to preflight requests', async () => { // GIVEN const shopify = shopifyApp(testConfig()); - const {token} = getJwt(); + const {token} = getJwt({dest: 'test-shop.myshopify.com'}); // WHEN const response = await getThrownResponse( @@ -69,7 +70,7 @@ describe('JWT validation', () => { it('responds to preflight requests from a different origin with extra CORS allowed headers', async () => { // GIVEN const shopify = shopifyApp(testConfig()); - const {token} = getJwt(); + const {token} = getJwt({dest: 'test-shop.myshopify.com'}); const request = new Request(APP_URL, { method: 'OPTIONS', headers: { From 34fc75d316a0e8f342772a5716d188b4b726e0ed Mon Sep 17 00:00:00 2001 From: Elizabeth Kenyon Date: Mon, 9 Dec 2024 16:15:17 -0600 Subject: [PATCH 3/3] changeset --- .changeset/ten-suns-sort.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ten-suns-sort.md diff --git a/.changeset/ten-suns-sort.md b/.changeset/ten-suns-sort.md new file mode 100644 index 0000000000..43d3bc7527 --- /dev/null +++ b/.changeset/ten-suns-sort.md @@ -0,0 +1,5 @@ +--- +'@shopify/shopify-app-remix': minor +--- + +Add Shop context to logging