I am using @elastic/synthetics-1.5.0 to write and deploy user journeys as project monitors. They run as expected when I test them on my local workstation, however when I push them to Elastic Synthetics, they fail with the following error, which appears to be from jquery:
Here is the full error from the console:
Failed to load resource: the server responded with a status of 403 ()
jQuery.Deferred exception: $(...).popover is not a function TypeError: $(...).popover is not a function
at HTMLDocument.<anonymous> (https://www.example.com/style/js/myapp/global.js?_=v73:150:15)
at e (https://www.example.com/style/js/jquery/jquery.min.js:2:30005)
at t (https://www.example.com/style/js/jquery/jquery.min.js:2:30307) undefined
$(...).popover is not a function
This appears to be an error in the page on the application side, not a script error. When I look at the output and screenshots generated by the individual steps, I am seeing what I expect to see, so it appears that this error is not interfering with the script running, but the test fails.
One question I have is how are you running the journeys with the Elastic stack. Are you using elastic-agent or the synthetics service? I don't believe 1.5.0 was bundled with any versions of the Elastic stack where this would have been an issue.
I've tried this based on your recommendation, but am still receiving the same error. Based on the error, it appears as if it's not the 403 error itself that is causing the failure, so this patch may be working as expected.
However, it looks as if there may be a jquery function (popover) that is missing. Other information I've found indicates that this could also be related to conflicting versions of jquery being used by the target application, which I don't have any control over.
Any other suggestions? Is there a playwright option that I haven't been able to find that might resolve this? Is there a way that I can ignore any errors except those explicitly thrown by my script (e.g., await expect(...).toBeTruthy())? I'm not the most familiar with TypeScript, but can I catch that error?
I'm not quite certain of the distinction you're making, but I'm writing the journeys locally on my machine with @elastic/synthetics ^1.5.2. They're being pushed with the npm run push command, and being deployed to private locations in our EKS environment running the elastic-agent-complete-8.10.4 image.
Do I need to wait for the next version of Elastic Agent to be released before I can resolve this issue?
The Elastic stack image 8.10.4 seems to be using the old synthetics agent version which is affected by this bug. You can confirm the version of the synthetics package by looking for the synthetics documents and checking this field package.version.
There are two workarounds here,
Using 8.10.3 which should have the older version of Synthetics
Waiting for the next release 8.11.0 which would be released with this fix.
I would suggest downgrading the stack to 8.10.3 version to work around it for now and move to 8.11 once the release is out.
We are working on improving this workflow, where you can control the version of the agent for Project based monitors. But unfortunately its not yet available. Please do let us know if you need further information.
Thanks - that's exactly what I needed to know; I had already gone in and checked the version of @elastic/synthetics inside the image and seen that it was v1.5.0, good to know that's also a field in the synthetics documents. It actually looks as if 8.11.0 was released today, so I'll upgrade to it, then downgrade to 8.10.3, if necessary for some reason.