Hey Guys,
I'm trying to deploy my first Node.js app using the apigeetool. First off, the JavaScript is transpiled Typescript, using ES6 target.
Now I'm getting the following error:
Error: Error uploading resource common\config.js: 500 { "code" : "messaging.config.beans.RepositoryError", "message" : "Repository error", "contexts" : [ ], "cause" : { "code" : "scripts.node.CompilationFailure", "message" : "Compilation error: common/config.js:11 missing ; before statement", "contexts" : [ ] } }
Now does this mean on line 11? I ask because I cannot see any issue with the JavaScript I'm trying to upload:
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // In Production we will set the environment variables. if (process.env.NODE_ENV !== "production") { const dotenv = require("dotenv"); dotenv.config(); } exports.DATABASE_URL = process.env.COSMOS_URL || "https://localhost:8081/"; exports.DATABASE_MASTER_KEY = process.env.COSMOS_KEY || "key"; exports.DATABASE_ID = process.env.COSMOS_DB || "db"; let stringBoolean = false; if (process.env.COSMOS_LOCAL == "undefined") { process.env.COSMOS_LOCAL = "false"; } if (process.env.COSMOS_LOCAL.toLowerCase() == "true") { stringBoolean = true; } else if (process.env.COSMOS_LOCAL.toLowerCase() == "false") { stringBoolean = false; } else { stringBoolean = false; } exports.COSMOS_LOCAL_EMULATOR = stringBoolean || true; //# sourceMappingURL=config.js.map
So I'm stuck really.
Solved! Go to Solution.
Hi @garethbradley, As you are using ES6 target, I assume the issue is with the Apigee's Nodejs.Are you using apigeetool deploynodeapp to deploy the proxy?
This uses the Nodejs App under Create Proxy wizard which runs on Trireme runtime is based on node 0.10.32. It's pretty old. And so it does not support ES6 including Promises, let/const, arrow function syntax, destructuring assignments, and so on. And that also means you cannot use the latest versions of various modules, including request.
Apigee has introduced something called as Hosted Targets which supports ES6 and latest modules. Hosted Targets can also be deployed using the same apigeetool. Please have a look at the docs for more info,
https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-overview