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

Migrating to the new build system @aws-sdk/lib-storage Upload is not working any more #27771

Closed
1 task done
mohammed-elrais opened this issue Jun 4, 2024 · 7 comments
Closed
1 task done
Labels
needs: investigation Requires some digging to determine if action is needed

Comments

@mohammed-elrais
Copy link

mohammed-elrais commented Jun 4, 2024

Command

build, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Before Migrating to the new build system

Description

I am trying to upload images to AWS but because of the Migrating to the new build system it is not working anymore

Minimal Reproduction

import { Upload } from "@aws-sdk/lib-storage";
import { S3Client } from "@aws-sdk/client-s3";


  const parallelUploads3 = new Upload({
    client:  new S3Client({}),
    params: { Bucket, Key, Body },
  });
  parallelUploads3.on("httpUploadProgress", (progress) => {
    console.log(progress);
  });

parallelUploads3.done() .then(
                (data) => {
                   console.log(data)
                },
                (err: any) => {
                    console.log(err)
                },
            );

Exception or Error

TypeError: Cannot read properties of undefined (reading 'done')
    at getChunkStream.js:5:5
    at Generator.next (<anonymous>)
    at resume (chunk-CDW57LCT.js?v=b9e9dd30:100:27)
    at chunk-CDW57LCT.js?v=b9e9dd30:106:63
    at new ZoneAwarePromise (zone.js:1425:21)
    at it.<computed> [as next] (chunk-CDW57LCT.js?v=b9e9dd30:106:38)
    at Upload.<anonymous> (Upload.js:130:9)
    at Generator.next (<anonymous>)
    at chunk-CDW57LCT.js?v=b9e9dd30:90:61
    at new ZoneAwarePromise (zone.js:1425:21)

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.8
Node: 18.13.0
Package Manager: npm 8.19.4
OS: darwin x64

Angular: 17.3.10
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.8
@angular-devkit/build-angular   17.3.8
@angular-devkit/core            17.3.8
@angular-devkit/schematics      17.3.8
@angular/cli                    17.3.8
@angular/google-maps            16.2.14
@schematics/angular             17.3.8
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

Anything else relevant?

    "dependencies": {
        "@angular-material-extensions/password-strength": "^16.0.0",
        "@angular/animations": "^17.3.7",
        "@angular/cdk": "^17.3.7",
        "@angular/common": "^17.3.7",
        "@angular/compiler": "^17.3.7",
        "@angular/core": "^17.3.7",
        "@angular/forms": "^17.3.7",
        "@angular/google-maps": "^16.2.14",
        "@angular/material": "^17.3.7",
        "@angular/material-moment-adapter": "^17.3.7",
        "@angular/platform-browser": "^17.3.7",
        "@angular/platform-browser-dynamic": "^17.3.7",
        "@angular/router": "^17.3.7",
        "@aws-sdk/client-s3": "^3.574.0",
        "@aws-sdk/credential-providers": "^3.574.0",
        "@aws-sdk/lib-storage": "^3.574.0",
        "@ngx-translate/core": "^14.0.0",
        "@ngx-translate/http-loader": "^7.0.0",
        "@tinymce/tinymce-angular": "^8.0.0",
        "angular-calendar": "^0.31.1",
        "angular-user-idle": "^4.0.0",
        "bootstrap": "^4.6.2",
        "file-saver": "^2.0.5",
        "moment": "^2.30.1",
        "ng2-pdf-viewer": "^10.0.0",
        "ngx-captcha": "^13.0.0",
        "ngx-image-cropper": "^7.2.1",
        "ngx-mask": "^16.4.2",
        "rxjs": "^7.4.0",
        "tslib": "^2.6.2",
        "xlsx": "^0.17.5",
        "zone.js": "~0.14.5"
    },
@alan-agius4 alan-agius4 added the needs: investigation Requires some digging to determine if action is needed label Jun 5, 2024
@cpt-cyrilcomor
Copy link

cpt-cyrilcomor commented Jul 19, 2024

Hello, having the exact same issue here with angular version 17
Any investigations undergoing ?

@kloc823
Copy link

kloc823 commented Aug 19, 2024

hello, how is it going?

@eXpertise7
Copy link

eXpertise7 commented Aug 21, 2024

@alan-agius4 Confirmed. This is actual issue. I think it's a critical priority.

@eXpertise7
Copy link

@mohammed-elrais @cpt-cyrilcomor @kloc823 Has anyone of you made issue request at @aws-sdk? I can't find it.

@kloc823
Copy link

kloc823 commented Aug 21, 2024

hi @eXpertise7, i didn't raise issue to aws since aws-sdk v3/v2 work good in my other (angular/react) projects

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Aug 22, 2024

I have looked into the issue and it appears to be caused by esbuild, as I was able to replicate the problem using the Angular CLI.

index.js

import { Upload } from "@aws-sdk/lib-storage";
import { S3Client } from "@aws-sdk/client-s3";

const text = "This is some sample text to stream.";

const readableStream = new ReadableStream({
  start(controller) {
    controller.enqueue(new TextEncoder().encode(text));
    controller.close();
  },
});

const parallelUploads3 = new Upload({
  client: new S3Client({}),
  params: { Body: readableStream },
});

parallelUploads3.on("httpUploadProgress", (progress) => {
  console.log(progress);
});

parallelUploads3.done().then(
  (data) => {
    console.log(data);
  },
  (err) => {
    console.log(err);
  }
);

esbuild.config.js

export default {
  platform: 'browser',
  bundle: true,
  entryPoints: ['./index.js'],
  supported: {
    'async-await': false,
  },
}

Commands

$ esbuild > output.js
$ node output.js
Cannot read properties of undefined (reading 'done')
    at output.js:16472:123
    at Generator.next (<anonymous>)
    at resume (output.js:56:31)
    at output.js:61:67
    at new Promise (<anonymous>)
    at it.<computed> [as next] (output.js:61:42)
    at Upload.<anonymous> (output.js:16728:97)
    at Generator.next (<anonymous>)
    at output.js:46:63
    at new Promise (<anonymous>)

Based on this, there is nothing actionable from our end at this point. This seems to be an issue with esbuild rather than Angular.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed
Projects
None yet
Development

No branches or pull requests

5 participants