AWS API Gateway Generated SDK does not contain client js file - javascript

I have created an API using the AWS Api Gateway Service, and am ready to use the javascript sdk in a simple webpage.
However, the instructions for using the javascript SDK here show an import for a js file called apigClient. I can only assume this is where the client class is stored for the api. However, when I generate the SDK for MY API, there is no such file (as in, the older file in the unzipped folder is lib. There is no js file in the root directory.)
Am I expected to create this file on my own? If so, I did not see any instructions to do so. Are there? What am I missing here?

I had the same problem, and I fixed it by deploying API.
See step4 "Deploy Your API" in this link.
https://aws.amazon.com/getting-started/projects/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-4/

Related

Using browser S3 sdk to upload file to alioss

How to switch endpoint in S3 SDK #aws-sdk/client-s3?
I want to use s3-SDK to upload files to ali oss, and I haven't found a way to update the endpoint by using #aws-sdk/client-s3
what I have found is the sample for nodejs, but I need a version for browser JS and using #aws-sdk/client-s3

Giving Netlify access to a file hidden by .gitignore on Github

I'm running into a bit of a dilemma with a repository in Github when I try to host the project on Netlify. The project includes a file named config.js and is referenced on both HTML pages. It includes some variables and a function to store my Google Maps API key, so I created a .gitignore file to hide it in my Github repository. The problem is, now that I've deployed it in Netlify, I'm not sure how to reference the config.js as an environment variable or something similar so that Netlify is able to find my Google Maps API key when it renders the site. Right now, the site renders, but it doesn't quite work because I'm running into errors since Netlify cannot see my config.js file.
You'll see my file structure below including the .gitignore command and my config.js that stores the Google Maps API key with the following variables and function calls:
let head = document.getElementsByTagName("head").item(0);
let script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute(
"src",
"<MY GOOGLE MAPS API KEY>"
);
head.appendChild(script);
My question is, how do I go about referencing the variables above that store my API key in an environment variable on Netlify? Or, is there a way to give only Netlify access to the config.js file without exposing it in Github?
There's some documentation on Netlify about deploy keys and submodules, but I don't understand that part of the docs and I'm not sure if they're even relevant to my problem.
You can add variables that you want to be included as part of your static site to Netlify's environment variables, as you've mentioned. That keeps them out of the Git repository.
The tricky part is getting those variables out of the Netlify build environment and into your source code. You have at least two different options, depending on how sensitive your variables are:
If you don't want your variables to be checked into Git but you are OK having them embedded into your public Javascript/HTML files (Google Maps API key might fall into this category), you can use a build tool like Webpack to inject environment variables into your source code. If you're using React or another framework, they usually have ways to include environment variables from the build environment. If you aren't, you may just need to write a custom build script or leverage a pre-built NPM package to inject a small <script>var myVar = "<myEnvironmentVariableValue>";</script> into your HTML page on build. Actually it looks like Netlify can inject some custom script into your page. Maybe you could try that.
If your variables are more sensitive and you don't want them publicly exposed, you need to add an actual server-side component. This could be as fancy as a serverless API or a standard humdrum web server. Then when your front-end needs this secret variable, it reaches out to the server and asks for it, presumably from within an authenticated portion of your website. That keeps the variables out of the public HTML/JS but still lets your site access them on demand.

API Gateway Javascript SDK - Node Js Examples?

So The API Gateway Javascript SDK is great to use in the front-end environment, but since the 10+ script files are required to be available globally, this does not play very nicely in an environment where most developers are used to importing npm packages.
Is there an example of anyone using the API Gateway SDK in backend Node.js environment? Here you cannot put the 10+ scripts in index.html file and I keep getting errors and when I try to make these files globally available for the SDK in Node environment.
There are two AWS SDKs for JavaScript. Use the one for node.js linked in the comment from MaiKaY. And here is the reference for the API Gateway portion of the SDK - http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/APIGateway.html

Angular JS with HANA

I have been trying to run a Angular JS application which is located in HANA. Since the Web IDE does not support Angular JS development, I have the application in Webstorm editor locally in my laptop.I am using a Resource override plug in to direct the location of my files towards local files. However when I run the index.html from the HANA server, I am getting HTTP 404 error.
Please verify that you have two files in the folder to allow web access:
.xsaccess see content guide here
.xsapp (empty file)

Run jar file with node js on Microsoft Azure

I make a node js web app for generating report. My idea is to use .jasper file (jasper report) to generate these reports. I've tried a bunch of node js library to do this, but nothing seems to work. And finally I proceed to make a .jar file (java) to solve this. The process is as follows:
Node js get request from user
Node js run .jar file by using child_process. It run something like "java -jar MyApp.jar arg1 arg2 arg3"
.jar file generate a pdf and save it to a folder
.jar file return the path of newly generated pdf file
Node js get the path and return pdf file to user
It run perfectly in my computer. Then I upload it to Microsoft Azure. It seems like the run .jar file step is failed, because no pdf file is created. Can anyone help me or suggest a better way to do this?
If you deployed the NodeJS webapp into MS Azure WebApps, the step 2 of the process could not spawn a child process for running a jar runnable file because the Java runtime environment not included your current Azure WebApp with NodeJS.
There are three suggested way to do this:
Using Azure VM to install NodeJS and Java, and deploy your app on the VM as the same as on the local computer. It's the simple way.
I searched an open source report software called jsreport. It can be install on MS Azure VM or Cloud Service. You can refer to the download page Run jar file with node js on Microsoft Azure to install it. And there is the jsreport sdk for NodeJS http://jsreport.net/learn/nodejs. If you want to use jsreport on Azure Cloud Service, you need to know how to build NodeJS App on Azure Cloud Service https://azure.microsoft.com/en-us/documentation/articles/cloud-services-nodejs-develop-deploy-express-app/.
Changing your process. NodeJS get request from user and send it with the specified file name and path to the ServiceBus; The jar runnable file modified as a Azure WebJob read the request from the ServiceBus and generate a pdf with the given file name and save it to the given file path on the Azure Blob Storage; NodeJS directly return pdf file to user from Blob Storage.
For Azure WebJob & Service Bus, you can refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/ and https://azure.microsoft.com/en-us/documentation/articles/service-bus-nodejs-how-to-use-queues/.
I suspect that your Java PDF generation calls into APIs restricted by the App Service sandbox. Most PDF rendering engines use GDI+, which has most functionality restricted by the Azure App Service sandbox. However, this policy is relaxed on dedicated servers. Scaling up to a dedicated server should resolve this problem (i.e. not the Shared or Free SKU).

Categories

Resources