V8-archive: Installing S3 SDK breaks api

Created on 30 Nov 2018  路  12Comments  路  Source: directus/v8-archive

Bug Report

After installing the S3 SDK via composer as explained here the app breaks. I get "Couldn't reach API" on the login screen.

PHP Error log:

PHP Fatal error:  Uncaught Error: Call to undefined function Directus\get_api_project_from_request() in /Users/seb/Code/directus7/src/web.php:16
Stack trace:
#0 /Users/seb/Code/directus7/public/index.php(3): require()
#1 {main}
  thrown in /Users/seb/Code/directus7/src/web.php on line 16

I don't get any other error message in directus logs. I'm on an MAMP environment.

Steps to Reproduce

  1. git clone directus suite // make install routine
  2. change config/api.php to use s3
  3. composer require aws/aws-sdk-php
  4. See error

Expected Behavior

Login and storage adapter working

Actual Behavior

unable to login

Other Context & Screenshots

Technical Details

  • Device: DEsktop
  • OS: MacOS Mojave / MAMP
  • Web Server: Apache
  • PHP Version: 7.2.8
  • Database: 5.7.23
  • Install Method: [eg: cloned master branch]
invalid optimization

Most helpful comment

@subicura, what @computerwizjared suggest is the way to go.

  1. Copy composer.json to your root directory.
  2. Run require aws/aws-sdk-php
  3. Run composer install

Everything should run normally.

All 12 comments

After debugging this, which was also reported here #606, the problem is that the build version in directus/directus doesn't include the composer.json file and when something is installed using composer the autoload is rewritten, removing all directus composer prs4 autoloading, removing all directus libraries from composer autoload.

I believe the proper way to fix this is to include the composer.json into the directus build repository.

ping @rijkvanzanten

Is there any other way to fix it? I want to use s3 for upload image.

@subicura I worked around this issue by grabbing https://raw.githubusercontent.com/directus/api/master/composer.json and putting it in the root directory of the directus/directus repo, then running the command. I also found that you need to install flysystem, like with Directus 6, although that may be unrelated to this issue.

@subicura, what @computerwizjared suggest is the way to go.

  1. Copy composer.json to your root directory.
  2. Run require aws/aws-sdk-php
  3. Run composer install

Everything should run normally.

Is that in the docs? @WellingGuzman

I had to run the command composer require league/flysystem-aws-s3-v3 as well

It works! Thanks a lot!

Is that in the docs? @WellingGuzman

no, this should be fixed in directus/directus, it's missing the composer.json. When that's done, it doesn't need those steps.

I had to run the command composer require league/flysystem-aws-s3-v3 as well

Thanks for pointing it out, it needs the league/flysystem-aws-s3-v3 package instead of aws/aws-sdk-php.

Closed this ticket in favor of https://github.com/directus/directus/issues/2273

@wellingguzman Should #2 be composer require aws/aws-sdk-php?

@adamjgrant This issue is pretty old, and Welling has moved on from the project long since. If you're having any issues now, I recommend opening a new issue

how do i install a directus for windows? Please help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nitwel picture Nitwel  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments

vuhrmeister picture vuhrmeister  路  3Comments

jwkellyiii picture jwkellyiii  路  3Comments

cdwmhcc picture cdwmhcc  路  3Comments