Skip to content

fix(export): show 'Data export requires Business Plan' on 404 for SaaS #97546

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
dataExport: show 'Data export requires Business Plan' on 404 for SaaS…
…; add test; keep generic/self-hosted fallback
  • Loading branch information
JoshFerge committed Aug 8, 2025
commit cfe9e2eea1909f24cb3e36d3c1cc64cd481852c4
18 changes: 18 additions & 0 deletions static/app/components/dataExport.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,22 @@ describe('DataExport', function () {
expect(addErrorMessage).toHaveBeenCalledWith('uh oh');
});
});

it('shows upgrade message on 404', async function () {
MockApiClient.addMockResponse({
url: `/organizations/${mockAuthorizedOrg.slug}/data-export/`,
method: 'POST',
statusCode: 404,
});

render(<DataExport payload={mockPayload} />, {
...mockContext(mockAuthorizedOrg),
});

await userEvent.click(screen.getByRole('button'));

await waitFor(() => {
expect(addErrorMessage).toHaveBeenCalledWith('Data export requires Business Plan');
});
});
});
12 changes: 8 additions & 4 deletions static/app/components/dataExport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicato
import Feature from 'sentry/components/acl/feature';
import {Button} from 'sentry/components/core/button';
import {t} from 'sentry/locale';
import ConfigStore from 'sentry/stores/configStore';
import useApi from 'sentry/utils/useApi';
import useOrganization from 'sentry/utils/useOrganization';

Expand Down Expand Up @@ -70,11 +71,14 @@ export function useDataExport({
if (unmountedRef?.current) {
return;
}
const isSelfHosted = ConfigStore.get('isSelfHosted');
const message =
err?.responseJSON?.detail ??
t(
"We tried our hardest, but we couldn't export your data. Give it another go."
);
err?.status === 404 && !isSelfHosted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 seems like the wrong status to return if they dont have the feature - is it worth following this pr up with an update in the backend?

? t('Data export requires Business Plan')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the button be disabled or removed if they can't export on their plan

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a feature flag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that is probably the better fix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not features.has("organizations:discover-query", organization):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just updated the branch. let me know if that makes sense.

: (err?.responseJSON?.detail ??
t(
"We tried our hardest, but we couldn't export your data. Give it another go."
));

addErrorMessage(message);
inProgressCallback?.(false);
Expand Down
Loading