Coursera Apigee Course 1 >> Lab: Pre-Requisites and Setup >> Getting 401 unauthorized

egutierrez
Participant I

I'm running the command replacing the values of user, password, organization, environment and firebase-hostname:

node setup -u apigee-username -p apigee-password -o apigee-org -e apigee-environment -f firebase-hostname

I'm getting build failure:

Modified files:

[INFO] Scanning for projects...

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building edge-developer-training-backend v1

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building edge-developer-training-idp v1

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ edge-developer-training-backend ---

[INFO] Deleting /Users/user/Downloads/setup/edge-developer-training-backend/target

[INFO]

[INFO] --- jshint-maven-plugin:1.6.0:lint (jslint) @ edge-developer-training-backend ---

[INFO]

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ edge-developer-training-idp ---

[INFO] Deleting /Users/user/Downloads/setup/edge-developer-training-idp/target

[INFO]

[INFO] --- maven-resources-plugin:2.6:copy-resources (default) @ edge-developer-training-idp ---

[INFO] using jshint version 2.5.6

[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] No config.json found. Skipping package configuration.

[INFO]

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

[INFO]

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

[INFO]

[INFO] --- maven-install-plugin:2.4:install (default-install) @ edge-developer-training-idp ---

[INFO] Installing /Users/user/Downloads/setup/edge-developer-training-idp/pom.xml to /Users/user/.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]

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

[INFO] /Users/user/Downloads/setup/edge-developer-training-backend/apiproxy/resources/jsc/AddProductNameToURI.js

[INFO] /Users/user/Downloads/setup/edge-developer-training-backend/apiproxy/resources/jsc/FormatLikeBaaS.js

[INFO] /Users/user/Downloads/setup/edge-developer-training-backend/apiproxy/resources/jsc/ProductAvailability.js

[INFO] /Users/user/Downloads/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] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 25 resources

[INFO]

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

[INFO]

Request prepared for the server

**************************

POSThttps://api.enterprise.apigee.com/v1/organizations/egutierrez-eval/apis?action=import&name=edge-developer-training-idp

accept: application/json

accept-encoding: gzip

authorization: Basic [Not shown in log]

content-type: application/octet-stream

[Request body contains data, not shown]

[INFO] ============= Reading the config file located at ================

/Users/user/Downloads/setup/edge-developer-training-backend/config.json

[INFO]

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

[INFO]

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

[INFO]

[INFO] --- apigee-config-maven-plugin:1.2.1:caches (create-config-cache) @ edge-developer-training-backend ---

[ERROR] 401 Unauthorized

[ERROR]

* * * * * * * * * * *

This deployment could have failed for a variety of reasons.

* * * * * * * * * * *

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 2.696 s

[INFO] Finished at: 2018-03-28T14:25:42-07:00

[INFO] ************************************************************************

[INFO] Apigee Cache

[INFO] ************************************************************************

[INFO] No cache config found.

[INFO]

[INFO] --- apigee-config-maven-plugin:1.2.1:targetservers (create-config-targetserver) @ edge-developer-training-backend ---

[INFO] ************************************************************************

[INFO] Apigee Target Servers

[INFO] ************************************************************************

[INFO] Retrieving existing environment Target Servers - test

[INFO] Final Memory: 13M/213M

[INFO] ------------------------------------------------------------------------

[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: 401 Unauthorized -> [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:35834) UnhandledPromiseRejectionWarning: #<Object>

(node:35834) 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:35834) [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]

Request prepared for the server

**************************

GEThttps://api.enterprise.apigee.com/v1/organizations/egutierrez-eval/environments/test/targetservers

accept: application/json

accept-encoding: gzip

authorization: Basic [Not shown in log]

[ERROR] 401 Unauthorized

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 3.722 s

[INFO] Finished at: 2018-03-28T14:25:43-07:00

[INFO] Final Memory: 22M/323M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:targetservers (create-config-targetserver) on project edge-developer-training-backend: Apigee network call error 401 Unauthorized -> [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/MojoFailureException

(node:35834) UnhandledPromiseRejectionWarning: #<Object>

(node:35834) 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)

I've double check my credentials and look good. Also I was able to execute management API using the same credentials and worked correctly.

This are the versions installed on my machine:

Apache Maven 3.5.3

Node.js v8.11.0

Java 8

0 20 763
20 REPLIES 20

By any chance, does your password have any special characters or in particular quote ? if you do, then can you pass it within double quotes

egutierrez
Participant I

Hi Sai, my password includes special character, so what I tried as you mentioned is pass it within double quotes, but still getting the same build failure.

So what I did was to reset my password and new pass doesn't include any special character and it worked.

Thanks. Was that special character a single quote (if I may ask), so that I can go back and check

It as a $

For example: apiGee$9

Thanks a lot. Will look into it

Is this solved @ssvaidyanathan I'm getting this error now?


Request prepared for the server ************************** GET https://api.enterprise.apigee.com/v1/organizations/#############/environments/test/targetservers accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] [ERROR] 401 Unauthorized [INFO] =============Importing App================ [INFO] Request prepared for the server ************************** POST https://api.enterprise.apigee.com/v1/organizations/#############/apis?action=import&name=edge-develo... accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/octet-stream [Request body contains data, not shown] [ERROR] 401 Unauthorized [ERROR] * * * * * * * * * * * This deployment could have failed for a variety of reasons. * * * * * * * * * * * [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.077 s [INFO] Finished at: 2018-10-09T11:34:24+02:00 [INFO] ------------------------------------------------------------------------ [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: 401 Unauthorized -> [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:10344) UnhandledPromiseRejectionWarning: #<Object> (node:10344) 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:10344) [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. [ERROR] 401 Unauthorized [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.388 s [INFO] Finished at: 2018-10-09T11:34:25+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:targetservers (create-config-targetserver) on project edge-developer-training-backend: Apigee network call error 401 Unauthorized -> [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/MojoFailureException (node:10344) UnhandledPromiseRejectionWarning: #<Object> (node:10344) 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)

egutierrez
Participant I

The issue was due the password had a special character. Even you send the value within double quotes it doesn't work.

The work around to make this work is to set a password without special character.

This is a bug. I hope this issue is fix quickly. I have been pulling my hair trying to figure what was I doing wrong...

How did you do this? In Edge, passwords without special characters are not allowed? I still went ahead and changed my password, however passwords without special characters are not allowed. My password has these @# special characters. I still get the same errors...

Very disappointed on how poorly this course is being supported in Coursera, specially when one is paying for it...

Hi @Ivan De Los Santos - Sorry about that. Will look into this and get back to you.

Hi @Ivan De Los Santos - have updated the script and instructions in Coursera, please download the latest setup.zip and follow the instructions. Re-wrote the setup script which should handle the special characters. Sorry about the delay, with the holidays, couldnt get approval quickly

Thanks.. Now it's working with latest setup.zip.

Hi @ Sai Saran,

Good day!

I am getting below error while testing thru in API Proxy trace with below URI but I could below Root check in Proxy backend.

http://xxxxxxx-test.apigee.net/v1/products

Response received from target server401 Unauthorized


Root flow check in Proxy back end.. Will it be causing the issue

edge-developer-training-backend:

<Flow name="root"> <Description/> <Request> <Step> <Name>Raise-Fault-401</Name> </Step> </Request> <Response/> <Condition>(proxy.pathsuffix = "/" or proxy.pathsuffix MatchesPath "") and (request.verb = "GET")</Condition> </Flow>

Please advise on this. Thx

That should not be the case, please recheck the instructions once again and see if you missed anything.

Not applicable

@Sai Saran Vaidyanathan, Hi, Good Day!!!

Thanks for your response.

As advised by you.. I have reviewed all configuration and everything looks good in API proxy and backend system. I have suspect below might be causing the issue due to that below Preflow flow and it would fail due to that "/" since it's always validate in precheck before calling products API with endpoint which I have given below.

proxy.pathsuffix = "/" -> it will not give success this case and always throwing 401 fault error.while execute below API endpoint with URI.

It's working fine after removing this "/ " check alone in script.

http://XXXXX-test.apigee.net/v1/products

Scirpt snippet:PreFlow

<Condition>(proxy.pathsuffix = "/" or proxy.pathsuffix MatchesPath "") and (request.verb = "GET")</Condition>

Please correct me if I am wrong.

Note: It has worked after removing "/" and request.verb = "GET" in PreFlow check

I am facing similar 401 unauthorized issue. Can someone please explain how to change the password, i have a trial version of Apigee edge and i cannot find the option to change the password.

Request prepared for the server ************************** POST https://api.enterprise.apigee.com/v1/organizations/xxxxxx-eval/apis?action=import&name=edge-develope... accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/octet-stream [Request body contains data, not shown] [ERROR] 401 Unauthorized [ERROR]

mihikanaik
Participant I

@Sai Saran Vaidyanathan I started the course on coursera. I have the latest setup.zip and I am still facing the issue. What can I do to fix it ?

Please open a new post

ok sure! Thanks