Share via

mssparkutils.env.getUserName() returns error when debugging Azure Synapse Analytics pipeline

Anonymous
2021-10-21T09:44:29.663+00:00

Error getting user information when debugging Azure Synapse Analytics pipeline with Synapse notebook executing statement mssparkutils.env.getUserName().

{
"errorCode": "6002",
"message": "Py4JJavaError: An error occurred while calling z:mssparkutils.env.getUserName.\n: org.json.JSONException: JSONObject[\"signaturePayload\"] not found.\n\tat org.json.JSONObject.get(JSONObject.java:520)\n\tat mssparkutils.env$$anonfun$extractField$2.$anonfun$applyOrElse$1(env.scala:28)\n\tat scala.util.Try$.apply(Try.scala:213)\n\tat mssparkutils.env$$anonfun$extractField$2.applyOrElse(env.scala:28)\n\tat mssparkutils.env$$anonfun$extractField$2.applyOrElse(env.scala:26)\n\tat scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)\n\tat scala.util.Failure.recoverWith(Try.scala:236)\n\tat mssparkutils.env$.extractField(env.scala:26)\n\tat mssparkutils.env$.getUserName(env.scala:44)\n\tat mssparkutils.env.getUserName(env.scala)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)\n\tat py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)\n\tat py4j.Gateway.invoke(Gateway.java:282)\n\tat py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)\n\tat py4j.commands.CallCommand.execute(CallCommand.java:79)\n\tat py4j.GatewayConnection.run(GatewayConnection.java:238)\n\tat java.lang.Thread.run(Thread.java:748)\n\nTraceback (most recent call last):\n\n File \"/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/notebookutils/mssparkutils/env.py\", line 8, in getUserName\n return envc.getUserName()\n\n File \"/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/py4j/java_gateway.py\", line 1304, in call\n return_value = get_return_value(\n\n File \"/opt/spark/python/lib/pyspark.zip/pyspark/sql/utils.py\", line 111, in deco\n return f(*a, **kw)\n\n File \"/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/py4j/protocol.py\", line 326, in get_return_value\n raise Py4JJavaError(\n\npy4j.protocol.Py4JJavaError: An error occurred while calling z:mssparkutils.env.getUserName.\n: org.json.JSONException: JSONObject[\"signaturePayload\"] not found.\n\tat org.json.JSONObject.get(JSONObject.java:520)\n\tat mssparkutils.env$$anonfun$extractField$2.$anonfun$applyOrElse$1(env.scala:28)\n\tat scala.util.Try$.apply(Try.scala:213)\n\tat mssparkutils.env$$anonfun$extractField$2.applyOrElse(env.scala:28)\n\tat mssparkutils.env$$anonfun$extractField$2.applyOrElse(env.scala:26)\n\tat scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)\n\tat scala.util.Failure.recoverWith(Try.scala:236)\n\tat mssparkutils.env$.extractField(env.scala:26)\n\tat mssparkutils.env$.getUserName(env.scala:44)\n\tat mssparkutils.env.getUserName(env.scala)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)\n\tat py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)\n\tat py4j.Gateway.invoke(Gateway.java:282)\n\tat py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)\n\tat py4j.commands.CallCommand.execute(CallCommand.java:79)\n\tat py4j.GatewayConnection.run(GatewayConnection.java:238)\n\tat java.lang.Thread.run(Thread.java:748)\n\n",
"failureType": "UserError",
"target": "<notebook>",
"details": []
}

Azure Synapse Analytics
Azure Synapse Analytics

An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Jha, Ayush 16 Reputation points
    2022-06-03T12:52:39.717+00:00

    We got these errors when we try to write the csv but usually it works fine in notebook directly when we run it.But using same notebook in pipeline breaks the pipeline.

    Was this answer helpful?


  2. MartinJaffer-MSFT 26,161 Reputation points
    2022-01-14T21:47:56.35+00:00

    I found out this was expected behavior and can be leveraged to determine whether a pipelien or a user started the job.

    Was this answer helpful?

    0 comments No comments

  3. MartinJaffer-MSFT 26,161 Reputation points
    2021-10-21T19:15:37.033+00:00

    Hello @CheuEngYeow-5385 and welcome to Microsoft Q&A. Thank you for bringing this issue to our attention.

    I have reproduced the error, and will report it to the product group.
    I also tried doing a triggered run and got the same error.

    I do not believe you are doing anything wrong. I suspect the cause is on the Synapse side.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.