Skip to content

Commit

Permalink
fix domain for backend in server + capture errors with sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal-Delange committed Mar 8, 2024
1 parent 3a79799 commit afbfb95
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/app-builder/src/services/auth/auth.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getServerEnv } from '@app-builder/utils/environment';
import { parseForm } from '@app-builder/utils/input-validation';
import { type RoutePath } from '@app-builder/utils/routes/types';
import { json, redirect } from '@remix-run/node';
import * as Sentry from '@sentry/remix';
import { marbleApi } from 'marble-api';
import { type CSRF } from 'remix-utils/csrf/server';
import * as z from 'zod';
Expand Down Expand Up @@ -130,7 +131,7 @@ export function makeAuthenticationServerService(
{
authorization: `Bearer ${idToken}`,
},
{ baseUrl: getServerEnv('MARBLE_API_DOMAIN_CLIENT') },
{ baseUrl: getServerEnv('MARBLE_API_DOMAIN_SERVER') },
);

const apiClient = getMarbleAPIClient(marbleToken.access_token);
Expand All @@ -140,6 +141,7 @@ export function makeAuthenticationServerService(
authSession.set('user', user);
redirectUrl = options.successRedirect;
} catch (error) {
Sentry.captureException(error);
authSession.flash('authError', { message: adaptAuthErrors(error) });

redirectUrl = options.failureRedirect;
Expand Down Expand Up @@ -174,7 +176,7 @@ export function makeAuthenticationServerService(
{
authorization: `Bearer ${idToken}`,
},
{ baseUrl: getServerEnv('MARBLE_API_DOMAIN_CLIENT') },
{ baseUrl: getServerEnv('MARBLE_API_DOMAIN_SERVER') },
);

const apiClient = getMarbleAPIClient(marbleToken.access_token);
Expand All @@ -199,6 +201,7 @@ export function makeAuthenticationServerService(
},
);
} catch (error) {
Sentry.captureException(error);
throw redirect(options.failureRedirect);
}
}
Expand Down

0 comments on commit afbfb95

Please sign in to comment.