New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing S3 SDK breaks api #620

Closed
Kinzi opened this Issue Nov 30, 2018 · 9 comments

Comments

Projects
6 participants
@Kinzi
Copy link
Contributor

Kinzi commented Nov 30, 2018

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]

@benhaynes benhaynes transferred this issue from directus/directus Nov 30, 2018

@benhaynes benhaynes added the bug label Nov 30, 2018

@benhaynes benhaynes added this to Needs triage in Bug Triage via automation Nov 30, 2018

@benhaynes benhaynes added this to To do in v2.0.10 via automation Nov 30, 2018

@WellingGuzman

This comment has been minimized.

Copy link
Member

WellingGuzman commented Nov 30, 2018

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

@WellingGuzman WellingGuzman moved this from Needs triage to Critical in Bug Triage Nov 30, 2018

@WellingGuzman WellingGuzman added invalid optimization and removed bug labels Dec 3, 2018

@rijkvanzanten rijkvanzanten added this to To do in v2.0.11 Dec 3, 2018

@subicura

This comment has been minimized.

Copy link

subicura commented Dec 26, 2018

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

@computerwizjared

This comment has been minimized.

Copy link

computerwizjared commented Dec 26, 2018

@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.

@WellingGuzman

This comment has been minimized.

Copy link
Member

WellingGuzman commented Dec 26, 2018

@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.

@benhaynes

This comment has been minimized.

Copy link
Contributor

benhaynes commented Dec 26, 2018

Is that in the docs? @WellingGuzman

@jasonmarysael

This comment has been minimized.

Copy link

jasonmarysael commented Dec 26, 2018

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

@subicura

This comment has been minimized.

Copy link

subicura commented Dec 27, 2018

It works! Thanks a lot!

@WellingGuzman

This comment has been minimized.

Copy link
Member

WellingGuzman commented Dec 28, 2018

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.

WellingGuzman added a commit that referenced this issue Dec 28, 2018

WellingGuzman added a commit to directus/docs that referenced this issue Dec 28, 2018

@WellingGuzman

This comment has been minimized.

Copy link
Member

WellingGuzman commented Dec 28, 2018

Closed this ticket in favor of directus/directus#2273

Bug Triage automation moved this from Critical to Closed Dec 28, 2018

v2.0.14 automation moved this from To do to Done Dec 28, 2018

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