Skip to content

πŸ›500 Error When Creating New Event Due to HTMLPurifier Cache Directory Not WritableΒ #319

@Wladefant

Description

@Wladefant

Description

When creating a new event, the backend throws a 500 Internal Server Error. The issue is caused because the HTMLPurifier library cannot write to its cache directory (DefinitionCache/Serializer).


Error Logs

[2024-12-17 12:36:51] local.DEBUG: Stripe secret key is not set in the configuration file. Payment processing will not work.   
[2024-12-17 12:36:51] local.ERROR: Directory /app/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer not writable.  
{"userId":1,"exception":"[object] (ErrorException(code: 0): Directory /app/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer not writable.  
at /app/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer.php:295)

Stack Trace:

#0 /app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(512, 'Directory /app/...', '/app/vendor/ezy...', 295)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->{closure}(512, 'Directory /app/...', '/app/vendor/ezy...', 295)
#2 /app/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer.php(295): trigger_error('Directory /app/...', 512)
...
#11 /app/app/Services/Domain/Event/CreateEventService.php(91): HTMLPurifier->purify('<p>asdf</p>')
#14 /app/app/Http/Actions/Events/CreateEventAction.php(39): HiEvents\Services\Handlers\Event\CreateEventHandler->handle(Object(HiEvents\Services\Handlers\Event\DTO\CreateEventDTO))
...
#59 /app/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#60 {main}

Steps to Reproduce

  1. Go to the /events endpoint and attempt to create a new event.
  2. The server returns a 500 Internal Server Error.
  3. Logs indicate the DefinitionCache/Serializer directory is not writable.

Expected Behavior

The event should be created successfully without errors.


Actual Behavior

The server throws a 500 error due to a write permission issue.


Root Cause

  1. HTMLPurifier Cache Directory Issue:
    The DefinitionCache/Serializer directory does not have the correct write permissions, causing HTMLPurifier to fail when attempting to write cache data.

  2. Stripe Configuration:
    The Stripe secret key is missing in the .env file.


Environment

  • running in docker the Local development version without stripe or keys

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions