AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Apache License 2.0
293 stars 90 forks source link

PrismaClientKnownRequestError: #1156

Open Muratoi opened 3 weeks ago

Muratoi commented 3 weeks ago

Describe the bug

When running tests from a node it crashes with the following error

Link to Appium logs

https://gist.github.com/Muratoi/1a3bb3361f27e75d43b5f1a9e0e539e8

Environment

  1. Appium version (or git revision) that exhibits the issue: 2.5.4
  2. Last Appium version that did not exhibit the issue (if applicable):
  3. Node.js version (unless using Appium.app|exe):
  4. Npm or Yarn package manager:
  5. Mobile platform/version under test: Android 12
  6. Real device or emulator/simulator: emulator
  7. Appium CLI or Appium.app|exe:
saikrishna321 commented 3 weeks ago

@Muratoi Please provide full logs

rock-tran commented 3 weeks ago
[XCUITestDriver@103e (eb66758f)] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAABNoAAAigCAIAAABm8NjOAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAE2qADAAQAAAABAAAIoAAAAAAWj13IAAAAHGlET1QAAAACAAAAAAAABFAAAAAoAAAEUAAABFAAA+zMwNZ8aQAAQABJREFUeAHsnQecJEd59lcoISSCERmbLLLJOdrkD4uMbYIxYIxtgkUGgzHBYJAQkgClk0gCAwKThMBEIZLIIIPC3eY8OU/nMN3fv6du+/omb5idmdt3fqVVdXd1ddVT1X311JumQvkJAoKAICAICAKCgCAgCAgCk49AIwyN0F1zyges9LXm+i6kA0Z60SoUfd0J/WDyAYx7YIeNfKgvVbM1z/RCcD34o49OGDiet3Fit/9PA2hbKTQX7PwujG+PR1xvrC8Z+bKtJfHZbTgm53nMITP0Mo16O6RTk9MLaakgIAgIAoKAICAICAKCgCDQCwE3bNQCe9UpzZiZ64yhM9LrjNS0mVmyCnm3BhM+xNt6tXECrrlhWAmtNa2Qd2pW0CSfTbbNHy8IXN8fVR/Gio4uG/mKo3vBETPsQxxVMLJCPxtoQkeHiLJULQgIAoKAICAICAKCgCAwcgS8MKj45qpd2jUZ6X4zNWdlM25VDxw/bPK2kaOwvQZAHmDXGauyZhbrvhVVttEtLjUaGwfbe8oW7h43Olq1dV/o6AAD2Rw4PxfqQkcHQEuKCAKCgCAgCAgCgoAgIAhMMgII78oNY9HKo0y7KzLSdVQ3Z40MesLVwHbC0dG1HRo1yANy5pJvoI9acrVGTEZ3qP7tVAO8SG5HrKxrRCO+ahTrjimy0UFGszmjgkJoCh0dBC4pIwgIAoKAICAICAKCgCAw2QhgzFloaPNGFtHlLjBSFtk8hWctmPliw8S+kfX3RP9ovxa6i2YeGanZcManO/DkkdPRaKz19TWj...
[HTTP] <-- GET /wd/hub/session/eb66758f-3209-4ad4-8d88-df4a7132347c/screenshot 200 2741 ms - 623496
[HTTP]
[HTTP] --> GET /device-farm/api/dashboard/session/eb66758f-3209-4ad4-8d88-df4a7132347c/app_profiling
[HTTP] {}
[device-farm-main] Updating lastCmdExecutedAt for device 8c91b5cc121b597d563947817e6ef790c44bf18e in session eb66758f-3209-4ad4-8d88-df4a7132347c
[HTTP] <-- GET /device-farm/api/dashboard/session/eb66758f-3209-4ad4-8d88-df4a7132347c/app_profiling 500 10 ms - 54
[HTTP]
[HTTP] --> DELETE /wd/hub/session/eb66758f-3209-4ad4-8d88-df4a7132347c
[HTTP] {}
[device-farm-main] Updating lastCmdExecutedAt for device 8c91b5cc121b597d563947817e6ef790c44bf18e in session eb66758f-3209-4ad4-8d88-df4a7132347c
Failed to update session: PrismaClientKnownRequestError:
Invalid `prisma.session.update()` invocation:

An operation failed because it depends on one or more records that were required but not found. Record to update not found.
    at In.handleRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6877)
    at In.handleAndLogRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6211)
    at In.request (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:5919)
    at l (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:127:11167) {
  code: 'P2025',
  clientVersion: '5.15.0',
  meta: { modelName: 'Session', cause: 'Record to update not found.' }
}
[device-farm-main] ******  UnhandledRejection ******
[device-farm-main] Reason:
PrismaClientKnownRequestError:
Invalid `prisma.session.update()` invocation:

An operation failed because it depends on one or more records that were required but not found. Record to update not found.
    at In.handleRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6877)
    at In.handleAndLogRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6211)
    at In.request (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:5919)
    at l (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:127:11167) {
  code: 'P2025',
  clientVersion: '5.15.0',
  meta: { modelName: 'Session', cause: 'Record to update not found.' }
}
[device-farm-main] PrismaClientKnownRequestError:
[device-farm-main] Invalid `prisma.session.update()` invocation:
[device-farm-main]
[device-farm-main]
[device-farm-main] An operation failed because it depends on one or more records that were required but not found. Record to update not found.
[device-farm-main]     at In.handleRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6877)
[device-farm-main]     at In.handleAndLogRequestError (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:6211)
[device-farm-main]     at In.request (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:122:5919)
[device-farm-main]     at l (/Users/mbhealth/Workspace/appium-server/node_modules/@prisma/client/runtime/library.js:127:11167)
[device-farm-main] Promise:
[device-farm-main] [object Promise]
[device-farm-main] Found 1 device candidates to be released
[device-farm-main] Cleaning pending sessions...
[device-farm-main] No pending sessions to clean
[device-farm-main] IOS Device details for 8c91b5cc121b597d563947817e6ef790c44bf18e already available
[device-farm-main] Added 0 new devices to local database
[device-farm-main] Updating remote android devices http://192.168.100.4:31337/device-farm/api/register
[device-farm-main] Pushed devices to hub 8c91b5cc121b597d563947817e6ef790c44bf18e 54746
[HTTP] --> GET /device-farm/api/status
[HTTP] {}
[HTTP] <-- GET /device-farm/api/status 200 1 ms - 66
[HTTP]

@saikrishna321 I also meet the same error. This error let the tests unable to be finished immediately (only ended after almost 1 minutes). The device is also unable to reuse.

saikrishna321 commented 3 weeks ago

@rock-tran only if full server logs are provided we can solve the problem.

SrinivasanTarget commented 1 week ago

Should be fixed in https://github.com/AppiumTestDistribution/appium-device-farm/pull/1194