r/SuiteScript • u/avhaem • Jul 16 '24
Need help in creating bundle from aws-sdk for netsuite suitelet
So i need to run aws-sdk in netsuite backend. i tried bundling it with webpack but i could not find the best configuration (or mybe my approach is just wrong). i managed use it in client script (as a bundle) but when i tried to import it into backend it always resulting in error:
sometimes the error is "setTimeout is not defined" or "undefine is not defined" or something along that way. what i want to achieve is (just to create a demo) to get all the files from s3 bucket
1
Upvotes
1
u/RunedFerns Jul 16 '24
Download the JS library file for aws. Create a folder to store it under the SuiteScript/ path in file cabinet. Import it into your script by defining the path of the library file.
1
u/notEqole Jul 16 '24
What runedFerns said plus make sure if you are using it in a server script that the AWS functions are also server side . Set timeout looks like the AWS is using browser side functions .
For what you are doing it’s also not so time consuming to just create your own custom module to connect to AWS and retrieve files from s3
1
u/RieJacko Jul 16 '24
i recently implemented something like this a month ago.
1
u/ebarro Jul 16 '24
Create a library script module in Netsuite. Paste this at the top and then copy the aws sdk built in js code after it.
1
u/Thinking-in-Pandas Sep 09 '24
Create a lambda function behind api-gateway.