Cannot Use fdk run

I’m trying to test an app I’m developing with fdk run. I have domain/a/tickets/ticketnumber&dev=true open.

When I try fdk run and then refresh the ticket page, the error beginning “TypeError” below occurs.

This was happening on node 12.22.6/fdk 6.13.2, so I updated to the latest version, and am seeing the same error.

➜  linked-tickets git:(master) ✗ node -v 
➜  linked-tickets git:(master) ✗ fdk --version 
Installed: 8.2.0
Already Up to Date..!
➜  linked-tickets git:(master) ✗ npm cache clean --force 
npm WARN using --force I sure hope you know what you are doing.
➜  linked-tickets git:(master) ✗ fdk run 
Installing dependencies...
+ base-64@0.1.0
+ got@11.1.0
updated 2 packages and audited 56 packages in 2.102s
6 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
Starting local testing server at http://*:10001/    
Append 'dev=true' to your Freshdesk account URL to start testing    
Quit the server with Control-C.
To simulate product, app setup, and external events, visit - http://localhost:10001/web/test
Populating test data with events found in the app
To test the installation page, visit - http://localhost:10001/custom_configs
TypeError: Cannot read property 'location' of undefined
    at addScopeToURLs (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/lib/routes/iframe.js:95:55)
    at iframeAPIHandler (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/lib/routes/iframe.js:113:14)
    at Layer.handle [as handle_request] (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/layer.js:95:5)
    at /home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:341:12)
    at next (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:174:3)
    at router (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:323:13)
    at /home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:341:12)
    at (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:275:10)
    at Immediate.<anonymous> (/home/jamie/.nvm/versions/node/v14.19.2/lib/node_modules/fdk/node_modules/express/lib/router/index.js:641:15)
    at processImmediate (internal/timers.js:466:21)
1 Like

Hi @Jamie, I have encountered this error before when I tested my app with the wrong product. I am not sure if that is the same case with you. Can you share the contents of the manifest.json file for the app under test? And, let us know what product you are testing it in?

1 Like

This isn’t a new app - fdk run was working fine a few weeks ago!


I’m getting same error. I have existing app that I was updating and saw this error and also I see the error on a brand new app I created with fdk create. I tried to delete the .fdk dir in home as suggested on another post but this did not address the error.

This happens when I connect the CRM to the test app using ?dev=true.

I see other recent posts on this topic. This appears to be a problem with FDK.

note: I have not noticed any negative behavior in my app so I think this can be ignored but its rather annoying.

Thanks for the updates @Jamie and @stevemc. I am trying to get our engineering team to look into this. cc @Aravind_Dasarathy

I had a call with a Freshworks engineer today. This issue was acknowledged as a fdk bug. I think he’s going to update this thread with more info soon about when a fix will be released.

@stevemc it works on my sandbox instance - that may be a temporary solution for you as well?

@Jamie , thanks for the info. That helps.

Hi folks, apologies for the delay in response. Yes, we have identified it as a bug needed to be addressed and our team is working on it. I don’t have a timeline on the fix yet.

The TypeError shows up when testing frontend apps for any of the “bundled” products. These include Freshsales Suite and Freshdesk, both of which bundle Freshcaller.

When using ?dev=true for testing frontend apps with fdk run, the products send a HTTP request to help FDK identify which product is being used. FDK then tries to find the matching product key by looking at the products declared in the manifest.json of the app-under-test. You can check this by looking for requests sent to localhost:10001 from the browser.

Product bundles have started sending an additional request with the product id of the bundled product, in this case, freshcaller. But given that the app manifest mentions only freshdesk (or freshworks_crm for Freshsales Suite), FDK fails for the additional request.

On digging deeper, we found that FDK does not handle this exception gracefully. So, as a first step, we are trying to allow FDK to handle this scenario where a bundled product is being tested.

There is also an additional scenario where a developer might be testing using a wrong product. I fell for it myself. Freshworks products have had recent naming changes, with multiple rebranding and rebundling for a few product. Thus, the mapping to their respective product ids in the app manifest is still confusing. So, FDK should ideally detect this and warn the developer if they are using a different product than they are supposed to.

In any case, none of these should break your workflow, because the error you see is caused by an extra request. You can ignore the TypeError till the fix comes out. But if your workflow breaks, then please let us know. There might be edge cases lurking around.

Hi there,

I’m experiencing this error and it seems to be potentially impacting my workflow. in dev=true mode, the application is supposed to load a custom iframe in the contact_entity_menu, but that section is not being rendered at all. You can see that the tabs are empty in the HTML in the attached screenshot.

I understand that the freshcaller call is a separate request, but it seems weird to me that the iframe is no longer rendering. Could this be related? Thanks!

Hi @sminn, thanks for reporting this. Do you see the same TypeError in the terminal? If so, the same fix will address the issue.

@HamsiniSivalenka is working on the fix. She confirmed that she has seen the same issue that you reported, where an app that was not loading for contact_entity_menu started working after the fix.

So, I guess this issue does affect certain workflows.

We are trying to roll out a fix soon once we have identified all the edge cases.

1 Like

@kaustavdm @HamsiniSivalenka Thanks so much for your attention on this issue. I just wanted to check in to see if there is an updated timeline on when this will be available in a published update to the FDK library? Thanks so much.

Thanks everyone for waiting patiently. We have rolled out a fix with FDK v8.3.1. Can y’all please update to that version and let me know if it addresses the issue for you?

(Edit: Updated current version number.)

Thanks - I’m running 8.3.1 and it looks like this works now!

1 Like

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