Coursera Lab pre-requisite error

GArnaud
Participant I

Hello

I got a lot of troubles setting up the Lab of Coursera...

Maven is installed and in the PATH, version 3.6.1:

$ mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
Maven home: C:\APPS\apache-maven-3.6.1\bin\..
Java version: 11.0.3, vendor: Amazon.com Inc., runtime: C:\Program Files\Amazon Corretto\jdk11.0.3_7
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

But, when running the node setup, I have:

$ node setup
prompt: Please provide the Apigee Edge username:  user@domain.com
prompt: Please provide the Apigee Edge password:  ******************


prompt: Please provide the Apigee Edge Organization name:  org-nonprod
prompt: Please provide the Apigee Edge Environment name:  dev
prompt: Please provide the Firebase Host name:  myname.firebaseio.com
Modified files: [object Object]
[[INFO] Scanning for projects...
INFO] Scanning for projects...
[[INFO]
[INFO] ---------------< apigee:edge-developer-training-backend >-------------INFO]
[INFO] -----------------< apigee:edge-developer-training-idp >-----------------
[INFO] Building edge-developer-training-idp v1
[INFO] --------------------------------[ pom ]---------------------------------
--
[INFO] Building edge-developer-training-backend v1
[INFO] --------------------------------[ pom ]---------------------------------
[[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ edge-developer-training-backend ---
INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ edge-developer-training-idp ---
[INFO] Deleting C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-idp\target
[INFO] Deleting C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (default) @ edge-developer-training-idp ---
[INFO]
[INFO] --- jshint-maven-plugin:1.6.0:lint (jslint) @ edge-developer-training-backend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- apigee-edge-maven-plugin:1.1.6:configure (configure-bundle) @ edge-developer-training-idp ---
[INFO] using jshint version 2.5.6
[INFO]   C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\apiproxy\resources\jsc\AddProductNameToURI.js
[INFO]   C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\apiproxy\resources\jsc\FormatLikeBaaS.js
[INFO]   C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\apiproxy\resources\jsc\ProductAvailability.js
[INFO]   C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\apiproxy\resources\jsc\UpdateTargetUrl.js
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (default) @ edge-developer-training-backend ---
[INFO] No config.json found. Skipping package configuration.
[INFO]

=============Checking for node.js app================

[INFO]

=============Now zipping the App Bundle================

[[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ edge-developer-training-idp ---
[INFO] Installing C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-idp\pom.xml to C:\Users\gavazzia\.m2\repository\apigee\edge-developer-training-idp\v1\edge-developer-training-idp-v1.pom
[INFO]
[INFO] --- apigee-edge-maven-plugin:1.1.6:deploy (deploy-bundle) @ edge-developer-training-idp ---
[INFO]

=============Initializing Maven Deployment================

[[INFO]
[INFO] --- apigee-edge-maven-plugin:1.1.6:configure (configure-bundle) @ edge-developer-training-backend ---
INFO]

=============Importing App================

[ERROR]

* * * * * * * * * * *

This deployment could have failed for a variety of reasons.


* * * * * * * * * * *

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.458 s
[INFO] Finished at: 2019-04-23T09:21:17+02:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "dev" could not be activated because it does not exist.
[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.6:deploy (deploy-bundle) on project edge-developer-training-idp: : MojoExecutionException: NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
(node:18828) UnhandledPromiseRejectionWarning: #<Object>
(node:18828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)(node:18828) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[INFO] ============= Reading the config file located at ================
C:\Temp\apigeeCourseraSetup\setup\edge-developer-training-backend\config.json
[ERROR]


=============No config tokens found for Environment null, for proxy file name default.xml================


[ERROR] null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.372 s
[INFO] Finished at: 2019-04-23T09:21:20+02:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "dev" could not be activated because it does not exist.
[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.6:configure (configure-bundle) on project edge-developer-training-backend: null: MojoExecutionException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
(node:18828) UnhandledPromiseRejectionWarning: #<Object>
(node:18828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

The DEV environment does exist, for sure...

Any idea about the reason why it failed?


Thanks in advance....

Solved Solved
0 4 562
2 ACCEPTED SOLUTIONS

@gavazzia

The error is not about DEV environment in Apigee.

Prompt:Please provide the ApigeeEdgeEnvironment name: dev

The above entry is the one causing the issue. try with test or prod, it will work.

setup.js is using the environment entry as the maven profile name

/*Executes the maven deployment plugin twice:1) creates the target serve, deploys the proxy.2) creates the Apigee product, apps, and developer*/

function deployProxyAndDependencies(proxyDir)
{  const mvn = require('maven').create({
  cwd: proxyDir,  profiles: [options.environment]  
});

The pom.xml for edge-developer-training* has the following profiles defined

<profiles> 
<profile> <id>test</id>
……..
<profile> <id>prod</id> 
<properties>
…….
</profile> 
</profiles>

View solution in original post

Hi @gavazzia

Since you are trying it on a non-trial Apigee org, looks like you have a dev environment. Can you please navigate to the edge-developer-training-backend and edge-developer-training-idp directories and update the pom file. Replace "test" to "dev" and then run the node script again

The assumption is that students would be running these labs on their trial accounts that have a "test" environment by default. You could do the same. If you plan to continue on the other org that does not have a test environment, then please update the pom as mentioned above and try running the script again

View solution in original post

4 REPLIES 4

@gavazzia

The error is not about DEV environment in Apigee.

Prompt:Please provide the ApigeeEdgeEnvironment name: dev

The above entry is the one causing the issue. try with test or prod, it will work.

setup.js is using the environment entry as the maven profile name

/*Executes the maven deployment plugin twice:1) creates the target serve, deploys the proxy.2) creates the Apigee product, apps, and developer*/

function deployProxyAndDependencies(proxyDir)
{  const mvn = require('maven').create({
  cwd: proxyDir,  profiles: [options.environment]  
});

The pom.xml for edge-developer-training* has the following profiles defined

<profiles> 
<profile> <id>test</id>
……..
<profile> <id>prod</id> 
<properties>
…….
</profile> 
</profiles>

Hi @gavazzia

Since you are trying it on a non-trial Apigee org, looks like you have a dev environment. Can you please navigate to the edge-developer-training-backend and edge-developer-training-idp directories and update the pom file. Replace "test" to "dev" and then run the node script again

The assumption is that students would be running these labs on their trial accounts that have a "test" environment by default. You could do the same. If you plan to continue on the other org that does not have a test environment, then please update the pom as mentioned above and try running the script again

GArnaud
Participant I

Thanks you!

I made it the easiest way: I used an eval organisation, with and prod environment.

By the way, in addition to pom.xml files, I guess the config.json and edge.json files need to be update as well.

GA.

Yes - thats right, forgot about that 🙂