AppExtensionsSDK in not a constructor

Hello, I’m building my first Custom UI APP. But I’m stuck on the initialization of the app SDK. I’m using Firebase functions to create an endpoint, but if I run it, I’m getting an error that AppExtensionsSDK is not a function.

const functions = require('firebase-functions');
const express = require('express');
const jwt = require('jsonwebtoken');
const initPD = require('./initPD')
const app = express();

app.get('/api/handlePipedriveRequest', async (req, res) => {
    try {
        const verifyToken = jwt.verify(req.query.token, 'XXXX');
        console.log("TOKEN", JSON.stringify(verifyToken));

        const sdk = await initPD.getCustomUISDK()
        console.log("SDK", sdk);

        const iframeContent = '<html><body>iframe content</body></html>';

    } catch (error) {
        console.error('JWT verification failed:', error);
        res.status(403).send('JWT token is invalid or expired');
}); = functions.https.onRequest(app);

And here is the initPD:

const { AppExtensionsSDK } = require('@pipedrive/app-extensions-sdk');

const getCustomUISDK = async () => {
    try {
        const SDK = await new AppExtensionsSDK({ identifier: '123abc' })
        .initialize({ size: { height: 500 } });
        return SDK
    } catch(err) {

module.exports = {

Lastly package.json:

  "name": "functions",
  "version": "1.0.0",
  "description": "",
  "main": "handlePipedriveRequest.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@pipedrive/app-extensions-sdk": "^0.9.0",
    "express": "^4.18.2",
    "firebase-admin": "^11.10.1",
    "firebase-functions": "^4.4.1",
    "firebase-tools": "^12.5.4",
    "jsonwebtoken": "^9.0.2"

Thanks for helping me out. Plus I wanna ask about the constructor - how does it automatically determine the request ID from a URL when it is not passed to it?

P.S.: I know I’m using static request ID, but it doesn’t have to do anything with that. It should throw a different error I believe, not that it is not a constructor.


Even when I tried to deploy it locally to test the SDK, I’m getting the same error:

Hi @Radek,

Welcome to our Developers’ Community! :wave:

I forwarded your query to our developers and they told me the following:

If we understand this use case correctly, then the user is trying to initialize the SDK server-side, which is not possible.
The SDK can be initialized only on the client side (in the browser).

Oh I see. Thanks for the answer :wink:

This topic was automatically closed after 10 days. New replies are no longer allowed.