Skip to content
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

storage upload issue #71

Open
rafoolin opened this issue Jul 20, 2022 · 5 comments
Open

storage upload issue #71

rafoolin opened this issue Jul 20, 2022 · 5 comments
Assignees
Labels
Investigate Working to figure out what's wrong!

Comments

@rafoolin
Copy link

Hi, When I run this example(after applying necessary changes), and want to upload a local image to storage on NHost, it fails.

Package:

nhost_sdk: ^3.0.2

Flutter doctor:

[✓] Flutter (Channel stable, 3.0.4, on macOS 12.3.1 21E258 darwin-arm (Rosetta), locale en-DE)
    • Flutter version 3.0.4 at /Users/my_user/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (3 weeks ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/my_user/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.69.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.44.0

[✓] Connected device (2 available)
    • iPhone 13 Pro Max (mobile) • 1269FB42-C790-4240-9148-32FF67DB2276 • ios          • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64 • macOS 12.3.1 21E258 darwin-arm (Rosetta)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Exception:

[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: ApiException: apiUrl=URL/v1/storage/files, statusCode=403, responseBody={error: {message: you are not authorized}}

I checked, when I use the email and password to sign in, I receive a response with a session that all the data are filled. So when I use client.storage.uploadBytes I expect headers be OK.

I also changed the permission of the database for storage_files and add role and gave them permission to insert and select and delete files, but I got internal server error by doing so.

Am I doing something wrong?

@szilarddoro
Copy link
Contributor

Hey @rafoolin! Did you successfully change the permissions of the storage.files table or encountered problems while doing so?

Our documentation describes all the necessary setup steps. We'll keep digging if the problem persists.

@rafoolin
Copy link
Author

rafoolin commented Sep 3, 2022

@szilarddoro I'm sorry for late response, didn't notice it.

Yes I followed these permissions, but still have the same problem and can't upload images as an authenticated user. Tested this both with local and remote databases and both throw the same exception as discussed above.

@MichalNemec
Copy link
Contributor

FileMetadata metadata = await NhostClientService.storage.uploadBytes(
      fileName: '${HelperHash.generateTimeHash()}_image',
      fileContents: image!.bytes,
      mimeType: 'image/jpeg', //'image/jpeg',
      bucketId: bucket,
    );

im using this implementation and permissions for user: insert(check) select(check) delete(check)

on local docker development, does minio say something?

@mhadaily mhadaily self-assigned this Dec 4, 2022
@mhadaily mhadaily added the Investigate Working to figure out what's wrong! label Dec 4, 2022
@mhadaily
Copy link
Contributor

@rafoolin can you please try our latest version https://pub.dev/publishers/nhost.io/packages

@shubhamsinghshubham777
Copy link

I'm facing the same issue with the following dependency versions:

  nhost_flutter_auth: ^3.0.0
  nhost_flutter_graphql: ^3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Working to figure out what's wrong!
Projects
None yet
Development

No branches or pull requests

5 participants