Issue getting custom app to run

Hi,

I have a very simple serverless custom app constructed with the help of the Freddy Copilot. The app is triggered by ticket update. When the app runs locally (via fdk run), and I attempt to load a ticket via https://ourfreshservice.com/tickets/1?dev=true, I get the following error in the VS Code console:

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at constructV2Response (C:\Users\neil.mercer\AppData\Roaming\npm\node_modules\fdk\lib\routes\iframe.js:66:26)
    at iframeAPIHandler (C:\Users\neil.mercer\AppData\Roaming\npm\node_modules\fdk\lib\routes\iframe.js:172:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
undefined
Uncaught exception thrown: Unexpected token u in JSON at position 0
Stack Trace: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at constructV2Response (C:\Users\neil.mercer\AppData\Roaming\npm\node_modules\fdk\lib\routes\iframe.js:66:26)
    at iframeAPIHandler (C:\Users\neil.mercer\AppData\Roaming\npm\node_modules\fdk\lib\routes\iframe.js:172:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

It appears the app isn’t even being triggered, as a) I haven’t yet performed an update on the ticket, and b) nothing is logged in the app logs.

Are there any suggestions on how to troubleshoot this?

Thanks.

Hi Neil,

I don’t think that error has anything to do with your App.

Serverless Apps can only be tested using the test framework provided by the FDK. You can access this with the URL provided when start FDK run. It allows you to test serverless app functions with the various product events you have added to your app using a dummy ticket update payload. The only way you can test serverless apps with live data is to build the app and publish it as a custom app.

1 Like

Hey @neilmercer

In addition to what @RobAtOpinyin wrote (which I fully agree with), you can kind of semi-live test locally if the ticket id and relevant data you put into the test payload are real ones.
Many times my serverless apps (1) act on ticket updates, (2) fetch some third party informations and (3) store it back on the ticket.
Step 2 and 3 can be tested pretty well if you go with “real” values.

For step 1 I often just log the serverless payload and put the custom app live in order to inspect it carefully and in order to use it as the test payload.

Best
Tom

Thanks Rob and Tom - I wish I could mark both your answers as the solution!

Ignoring what the FDK was telling me and using the simulation function solved my issue, and Tom’s point about being able to use actual ticket data in the simulation was a great point that made testing much simpler.

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.