Skip to content

🐛 v2 Organizer settings page requests /api/events/undefined (500) via EmailTemplateSettings #1370

Description

@zigman79

Describe the bug

Opening the organizer settings page (/manage/organizer/{id}/settings) triggers GET /api/events/undefined, which returns a 500. React Query retries it three times, so each page view logs 4 errors:

production.ERROR: HiEvents\Http\Actions\Events\GetEventAction::__invoke(): Argument #1 ($eventId) must be of type int, string given

Functionally nothing breaks, but it fills the logs and error tracking.

Cause

frontend/src/components/common/EmailTemplateSettings/EmailTemplateSettingsBase.tsx:83:

const eventQuery = useGetEvent(contextType === 'event' ? contextId : undefined);

In the organizer context eventId is undefined, but frontend/src/queries/useGetEvent.ts has no enabled guard, so the request is sent anyway:

export const useGetEvent = (eventId: IdParam) => {
    return useQuery<Event, AxiosError>({
        queryKey: [GET_EVENT_QUERY_KEY, eventId],
        queryFn: async () => { ... },
    });
};

Suggested fix

Add enabled: !!eventId to useGetEvent. Optionally, the backend could return 404 instead of 500 for a non-numeric event_id (route constraint whereNumber('event_id')).

To Reproduce

  1. Open /manage/organizer/{id}/settings.
  2. Watch the network tab or storage/logs/laravel.log: 4× GET /api/events/undefined → 500.

Hi.Events Version and platform

  • Version: v2.0.0-rc.1 (daveearley/hi.events-all-in-one:v2.0.0-rc.1)
  • Platform: self-hosted Docker Compose, PostgreSQL 17

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions