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

Unable to resolve module events in @aws-sdk/lib-storage #2156

Closed
jereztech opened this issue Mar 19, 2021 · 8 comments
Closed

Unable to resolve module events in @aws-sdk/lib-storage #2156

jereztech opened this issue Mar 19, 2021 · 8 comments
Assignees
Labels
bug This issue is a bug.

Comments

@jereztech
Copy link

Unable to resolve module events in @aws-sdk/lib-storage/dist/cjs/Upload.js

"@aws-sdk/client-s3": "^3.9.0",
"@aws-sdk/lib-storage": "^3.9.0",
"react": "17.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",

@jereztech jereztech added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 19, 2021
@ajredniwja
Copy link
Contributor

Hey @jereztech, thanks for opening this issue, can you please follow the issue template?

I am looking for more information on how to reproduce this. Thankyou

@ajredniwja ajredniwja self-assigned this Mar 19, 2021
@ajredniwja ajredniwja added the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Mar 19, 2021
@jereztech
Copy link
Author

jereztech commented Mar 19, 2021

Hi @ajredniwja, thanks for reply.

Bug Description:
importing @aws-sdk/lib-storage@3.9.0 module crashes the application

Environment:
@aws-sdk/lib-storage@3.9.0
react-native-cli@2.0.1
expo-cli@4.3.1
node@14.15.4
npm@7.6.3

Minimal Repo:
https://snack.expo.io/@jjerezalo/eabc8c (Snack: Failed to resolve dependency '@aws-sdk/lib-storage@^3.9.0' - Cannot resolve module fs after installing it as a dependency)

Using expo init lib-storage-demo, just add the fallowing to package.json and then npm install
"@aws-sdk/client-cognito-identity": "^3.9.0",
"@aws-sdk/client-s3": "^3.9.0",
"@aws-sdk/credential-provider-cognito-identity": "^3.9.0",
"@aws-sdk/lib-storage": "^3.9.0",

Error: Unable to resolve module events from /Users/.../.../.../node_modules/@aws-sdk/lib-storage/dist/cjs/Upload.js: events could not be found within the project.

I'm following the official documentation: https://www.npmjs.com/package/@aws-sdk/lib-storage

My minimal code:

import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { Upload } from "@aws-sdk/lib-storage";
import {
    S3Client,
} from "@aws-sdk/client-s3";

const REGION = "us-east-2";
const s3Client = new S3Client({
    region: REGION,
    credentials: fromCognitoIdentityPool({
        client: new CognitoIdentityClient({ region: REGION }),
        identityPoolId: "IDENTITY_ID",
    }),
});

export const uploadFile = async (bucketName, key, file, onProgressFn, onResponseFn) => {
    try {
        const paralellUploads3 = new Upload({
            client: s3Client,
            params: { Bucket: bucketName, Key: key, Body: file },
        });
        paralellUploads3.on("httpUploadProgress", (progress) => {
            console.log(progress);
            onProgressFn && onProgressFn(progress)
        });
        return await paralellUploads3.done();
    } catch (e) {
        console.log(e);
    }
}

Importing Upload from @aws-sdk/lib-storage crashes the application.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Mar 20, 2021
@ajredniwja
Copy link
Contributor

This is a duplicate of #2136

Workaround for now is to lower the version of lib-storage to 3.7.0 in your pacakge.json

I have created a PR for the fix #2165

The issue should be resolved soon. Thankyou

@trivikr
Copy link
Member

trivikr commented Mar 22, 2021

Fixed in #2165, to be published with the next release expected on 3/25 or 3/26.

@trivikr trivikr closed this as completed Mar 22, 2021
@VitaliiShpital
Copy link

VitaliiShpital commented Mar 26, 2021

could someone confirm please if it'll be released today? @trivikr ?

@trivikr
Copy link
Member

trivikr commented Mar 26, 2021

could someone confirm please if it'll be released today?

Yes. The fix will be released today with v3.10.0

@VitaliiShpital
Copy link

@trivikr thank you!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants