Skip to content

500 Server Error when trying to create new Category or selecting integrations #14487

Open
@struett1

Description

Debug mode

Describe the bug

Getting the 500 server error when I try to create a new category or select Integrations from the admin settings. The /var/www/snipeit/bootstrap/cache directory is already present and writable.

Reproduction steps

For integrations
1.Go to Admin settings
2.Click Integrations
3.500 server errror

For Categories

  1. Go to settings > Categories
  2. Click create new
  3. 500 server error

...

Expected behavior

I should be able to create categories without issue as well as set up any kind of Slack integration if needed.

Screenshots

No response

Snipe-IT Version

v6.3.3 build 12903 (g0f63fa23e)

Operating System

CentOS 7

Web Server

Apache

PHP Version

8.0.30

Operating System

macOS

Browser

Chrome

Version

macOS 14.3.1 / Chrome 123.0.6312.59

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

Creating a new category:
500 server error
    public function build()

    {

        $this->manifest = $this->getClassNames()

            ->mapWithKeys(function ($class) {

                return [$class::getName() => $class];

            })->toArray();

 

        $this->write($this->manifest);

 

        return $this;

    }

 

    protected function write(array $manifest)

    {

        if (! is_writable(dirname($this->manifestPath))) {

            throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.');

        }

 

        $this->files->put($this->manifestPath, '<?php return '.var_export($manifest, true).';', true);

    }

 

    public function getClassNames()

    {

        if (! $this->files->exists($this->path)) {

            return collect();

        }

 

        return collect($this->files->allFiles($this->path))

            ->map(function (SplFileInfo $file) {

                return app()->getNamespace().

                    str($file->getPathname())


Integrations:
500 server error
    public function build()

    {

        $this->manifest = $this->getClassNames()

            ->mapWithKeys(function ($class) {

                return [$class::getName() => $class];

            })->toArray();

 

        $this->write($this->manifest);

 

        return $this;

    }

 

    protected function write(array $manifest)

    {

        if (! is_writable(dirname($this->manifestPath))) {

            throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.');

        }

 

        $this->files->put($this->manifestPath, '<?php return '.var_export($manifest, true).';', true);

    }

 

    public function getClassNames()

    {

        if (! $this->files->exists($this->path)) {

            return collect();

        }

 

        return collect($this->files->allFiles($this->path))

            ->map(function (SplFileInfo $file) {

                return app()->getNamespace().

                    str($file->getPathname())

Additional context

Tried the solution from #13714, but the issue persisted.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions