SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js

Home Page:https://adminjs.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I call aws-sdk from client?

eakenbor opened this issue · comments

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";

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