Problem when calling custom endpoint from pre-registration hook