vite-plugin-s3 icon indicating copy to clipboard operation
vite-plugin-s3 copied to clipboard

An error was encountered in a non-retryable streaming request

Open mabdelfattah opened this issue 11 months ago • 4 comments

I'm getting the following error when building

$ ~/.bun/bin/bun run build
$ vite build
vite v5.4.13 building for production...
transforming...
✓ 554 modules transformed.
rendering chunks...
computing gzip size...
public/build/manifest.json              0.33 kB │ gzip:   0.17 kB
public/build/assets/app-PMYh9yEF.css    7.84 kB │ gzip:   3.17 kB
public/build/assets/app-X5Me8f06.css   71.51 kB │ gzip:  12.37 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
public/build/assets/app-7ez11_SZ.js   590.98 kB │ gzip: 186.09 kB │ map: 2,636.63 kB
✓ built in 7.13s
Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.
Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.
Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.
Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.
Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.
An error was encountered in a non-retryable streaming request.
error during build:
400: UnknownError
    at new ServiceException (/var/www/html/node_modules/@smithy/smithy-client/dist-cjs/index.js:817:5)
    at new S3ServiceException (/var/www/html/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:329:5)
    at throwDefaultError (/var/www/html/node_modules/@smithy/smithy-client/dist-cjs/index.js:867:24)
    at <anonymous> (/var/www/html/node_modules/@smithy/smithy-client/dist-cjs/index.js:876:5)
    at processTicksAndRejections (native:7:39)
error: script "build" exited with code 1
#20 ERROR: process "/bin/sh -c ~/.bun/bin/bun run build" did not complete successfully: exit code: 1

mabdelfattah avatar Jan 21 '25 08:01 mabdelfattah

Hi @mabdelfattah do you still experience this issue?

SergkeiM avatar Mar 24 '25 07:03 SergkeiM

Same error: An error was encountered in a non-retryable streaming request.

arshaplus avatar Mar 25 '25 09:03 arshaplus

I have the same error

andrii-trush avatar Jun 01 '25 08:06 andrii-trush

I got same error, all configuration was correct in .env. after spending some time fix it with the following

===================

before you follow, you can quick test, it will confirm the following solution will work for you or not.

  1. replace all process.env. environment variables with static value (directly insert in vite.config.js), like access key, SECRET_ACCESS_KEY and all other configuration value. (only for test purpose on dev, never use in production)
  2. npm run build, if it now start working then it sure you have same issue like me, to not getting environment variable value.
  3. now you can apply the following solution.

=================== to get config value in vite.config.js npm install dotenv --save-dev

then import in vite.config.js import viteS3 from 'vite-plugin-s3'; import dotenv from 'dotenv';

// Load .env file dotenv.config();

export default defineConfig({ ...

==================== now vite.config.js file can get the correct .env file value and it start working as expected to upload files on s3.

Note: you may also need to define UPLOAD_ENABLED=true inside your .env

May this will help. thanks

================== to get it render on frontend you need something like ASSET_URL=https://cdn.example.com

https://laravel.com/docs/12.x/vite#custom-base-urls

shahidbscs avatar Jul 05 '25 19:07 shahidbscs