SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.06k stars 646 forks source link

How do I call aws-sdk from client? #1660

Closed eakenbor closed 2 months ago

eakenbor commented 2 months ago

Contact Details

No response

What happened?

I am unable to communicate with my AWS-S3 from my adminjs frontend as I could not import the sdk from nodejs server file into the frontend. Also I tried to use @aws-sdk/client-s3 which does not work either. Instead I got the following error:

No name was provided for external module "stream" in "output.globals" – guessing "require$$0$4".
No name was provided for external module "http" in "output.globals" – guessing "require$$2".
No name was provided for external module "https" in "output.globals" – guessing "require$$3$1".
No name was provided for external module "http2" in "output.globals" – guessing "require$$5".
No name was provided for external module "os" in "output.globals" – guessing "require$$0$5".
No name was provided for external module "crypto" in "output.globals" – guessing "require$$0$6".
No name was provided for external module "fs" in "output.globals" – guessing "require$$0$7".
No name was provided for external module "child_process" in "output.globals" – guessing "require$$2$1".
Creating a browser bundle that depends on Node.js built-in modules ("stream", "http", "https", "http2", "os", "crypto", "fs" and "child_process"). You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node

@dziraf can you help me please?

Bug prevalence

Every time

AdminJS dependencies version

"adminjs": "^7.8.1", "@aws-sdk/client-s3": "^3.556.0", "aws-sdk": "^2.465.0",

What browsers do you see the problem on?

Chrome

Relevant log output

No response

Relevant code that's giving you issues

import { S3Client, ListBucketsCommand } from "@aws-sdk/client-s3";
dziraf commented 2 months ago

you cannot use backend libraries in the frontend, this is not a bug

create an action or a custom endpoint to act as a proxy and use the SDK in the backend