# Unable to run zoomapps-sample-js

**URL:** <https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998>\
**Category:** Zoom Apps\
**Created:** [February 13, 2023, 2:52am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998 "2023-02-13T02:52:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![thr](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@thr](https://devforum.zoom.us/u/thr)\
**Post date:** [February 13, 2023, 2:52am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/1 "2023-02-13T02:52:17Z")

</div>

I just went through the tutorial video on YouTube: [tutorial](https://www.youtube.com/watch?v=SS87nqO9ScQ&t=109s), [sample app](https://github.com/zoom/zoomapps-sample-js), and done everything in the video. In the last step, when i launched the zoom app, the app was launched, but it pops out an error “An unknown error occurred, Error code: 122”. I cannot resolve it, and I didn’t find information about this error.

OS: Ubuntu 22.04 LTS

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [February 13, 2023, 11:25pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/2 "2023-02-13T23:25:11Z")

</div>

Welcome, @thr ,

Thank you for posting in the Zoom Developer Forum and I am happy to help! As a start, can you share the error message you are seeing and the steps to reproduce if possible?

---

<div class="post-metadata">

**Author:** ![thr](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@thr](https://devforum.zoom.us/u/thr)\
**Post date:** [February 13, 2023, 11:43pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/3 "2023-02-13T23:43:40Z")

</div>

1. i git clone the zoomapps-sample-js from [GitHub - zoom/zoomapps-sample-js: A Hello World Zoom App built with Vanilla JS](http://github.com/zoom/zoomapps-sample-js)
2. run npm install in the directory
3. run ngrok http 3000 and create and config a zoom app on zoom market.
4. config the .env file in the git cloned file.
5. access the https://…ngrok.io that generate by ngrok http 3000
6. click the localhost:3000 and the zoom is launched and a few seconds later, then an error occurred: “An unknown error occurred, Error code: 122”.

---

<div class="post-metadata">

**Author:** ![thr](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@thr](https://devforum.zoom.us/u/thr)\
**Post date:** [February 14, 2023, 12:46am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/4 "2023-02-14T00:46:58Z")

</div>

if i click https://…ngrok.io/auth  
then i receive this

```auto
Error 400
invalid state parameter

BadRequestError: invalid state parameter
    at handleError (file:///home/user/Documents/zoomapps_sample/server/helpers/routing.js:35:12)
    at file:///home/user/Documents/zoomapps_sample/server/routes/auth.js:55:14
    at Layer.handle [as handle_request] (/home/user/Documents/zoomapps_sample/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/user/Documents/SURE/zoomapps_sample/node_modules/express/lib/router/route.js:137:13)
    at middleware (/home/user/Documents/zoomapps_sample/node_modules/express-validator/src/middlewares/check.js:16:13)

```

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [February 27, 2023, 7:35pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/5 "2023-02-27T19:35:27Z")

</div>

Instead of navigating to the auth route to install the app, try opening the home page in a browser. You should see a link to install the app which will generate a state and start the authorization flow.

Let me know if that helps 🙂

---

<div class="post-metadata">

**Author:** ![patrick4](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/patrick4/32/45973_2.png) [@patrick4](https://devforum.zoom.us/u/patrick4)\
**Post date:** [March 1, 2023, 7:56am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/6 "2023-03-01T07:56:10Z")

</div>

Any updates to this? I have the same issue.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 1, 2023, 10:30pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/7 "2023-03-01T22:30:29Z")

</div>

Are you navigating directly to the /auth page or are you clicking the install link from the home page? Using the install link from the home page is what you’ll want to do with this app as it will generate the state parameter that needs to be verified.

I hope that helps!

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 1, 2023, 11:53pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/8 "2023-03-01T23:53:34Z")

</div>

@patrick4 @thr I was able to reproduce this behavior on my end and am working to push out a fix ASAP

---

<div class="post-metadata">

**Author:** ![patrick4](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/patrick4/32/45973_2.png) [@patrick4](https://devforum.zoom.us/u/patrick4)\
**Post date:** [March 1, 2023, 11:54pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/9 "2023-03-01T23:54:37Z")

</div>

@MaxM Great news! Please keep us updated.

---

<div class="post-metadata">

**Author:** ![shunji.lin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shunji.lin/32/46026_2.png) [@shunji.lin](https://devforum.zoom.us/u/shunji.lin)\
**Post date:** [March 2, 2023, 3:42am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/10 "2023-03-02T03:42:37Z")

</div>

It seems like the session is being cleared when redirecting to the `/auth` handler, hence the validation (checking if the query parameters matches the session parameters) fails, not sure if this is the intended behavior

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 2, 2023, 9:13pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/11 "2023-03-02T21:13:39Z")

</div>

@patrick4 @shunji.lin @thr

I took a look into this and got everything working by updating dependencies and cloning a fresh copy.

Are you still running into this issue when re-cloning the repo?

---

<div class="post-metadata">

**Author:** ![shunji.lin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shunji.lin/32/46026_2.png) [@shunji.lin](https://devforum.zoom.us/u/shunji.lin)\
**Post date:** [March 3, 2023, 6:04am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/12 "2023-03-03T06:04:48Z")

</div>

I recloned the repo and still face the same error:

```auto
Error 400
invalid state parameter

BadRequestError: invalid state parameter
    at handleError (file:///home/shunji/zoomapps-sample-js/server/helpers/routing.js:35:12)
    at file:///home/shunji/zoomapps-sample-js/server/routes/auth.js:55:14
    at Layer.handle [as handle_request] (/home/shunji/zoomapps-sample-js/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/shunji/zoomapps-sample-js/node_modules/express/lib/router/route.js:137:13)
    at middleware (/home/shunji/zoomapps-sample-js/node_modules/express-validator/src/middlewares/check.js:16:13)

```

as mentioned in the previous reply, it seems the session does not persist between the redirect from the /install to the /auth handler, this does not seem to be a problem with repo.

It seems like the [documentation](https://marketplace.zoom.us/docs/zoom-apps/guides/authentication/#) recommends to store the `code_verifier` and `state_noonce` in the db and not in the session, so maybe this is the issue?

---

<div class="post-metadata">

**Author:** ![shunji.lin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shunji.lin/32/46026_2.png) [@shunji.lin](https://devforum.zoom.us/u/shunji.lin)\
**Post date:** [March 3, 2023, 6:48am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/13 "2023-03-03T06:48:55Z")

</div>

I am also getting a similar error from the [advanced app](https://github.com/zoom/zoomapps-advancedsample-react) example, it is also retrieving the `state` from the session

```auto
Error: Invalid state parameter
    at auth (/home/node/app/api/zoomapp/controller.js:173:21)
    at Layer.handle [as handle_request] (/home/node/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/node/app/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/home/node/app/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/home/node/app/node_modules/express/lib/router/layer.js:95:5)
    at /home/node/app/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/home/node/app/node_modules/express/lib/router/index.js:346:12)
    at next (/home/node/app/node_modules/express/lib/router/index.js:280:10)
    at Function.handle (/home/node/app/node_modules/express/lib/router/index.js:175:3)
    at router (/home/node/app/node_modules/express/lib/router/index.js:47:12)

```

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 3, 2023, 9:46pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/14 "2023-03-03T21:46:51Z")

</div>

> [@shunji.lin](#):
>
> It seems like the [documentation](https://marketplace.zoom.us/docs/zoom-apps/guides/authentication/#) recommends to store the `code_verifier` and `state_noonce` in the db and not in the session, so maybe this is the issue?

Can you point me to what section of the documentation you are referring to?

> [@shunji.lin](#):
>
> I am also getting a similar error from the [advanced app](https://github.com/zoom/zoomapps-advancedsample-react) example, it is also retrieving the `state` from the session

What platform, browser and browser version are you testing with? I just want to make sure I’m attempting to reproduce the issue in the same way.

---

<div class="post-metadata">

**Author:** ![shunji.lin](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shunji.lin/32/46026_2.png) [@shunji.lin](https://devforum.zoom.us/u/shunji.lin)\
**Post date:** [March 8, 2023, 1:51am UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/15 "2023-03-08T01:51:12Z")

</div>

I am using windows 11, firefox version 110.0.1 as well as chrome 110.0.5481.178

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 8, 2023, 11:19pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/16 "2023-03-08T23:19:19Z")

</div>

Thanks for sharing that information. I tested this out on Windows 11 using Chrome 111.0.5563.65 but I wasn’t seeing the same issue.

Does this happen when using an incognito window as well?

---

<div class="post-metadata">

**Author:** ![markusp](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/markusp/32/36577_2.png) [@markusp](https://devforum.zoom.us/u/markusp)\
**Post date:** [March 20, 2023, 4:25pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/17 "2023-03-20T16:25:10Z")

</div>

Getting same thing on this sample app:

> **[GitHub - zoom/zoomapps-customlayout-js: A simple podcaster Zoom App to...](https://github.com/zoom/zoomapps-customlayout-js)**
>
> A simple podcaster Zoom App to demonstrate Immersive Mode through our Layers API - GitHub - zoom/zoomapps-customlayout-js: A simple podcaster Zoom App to demonstrate Immersive Mode through our Laye...

Tried on incognito too.

Navigating to localhost:3000, then clicking the install link, then going through Zoom OAuth, then redirected back and getting:  
“Error 400  
invalid state parameter”

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 22, 2023, 8:31pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/18 "2023-03-22T20:31:51Z")

</div>

Thanks for getting back to me on this. I sent you a DM to schedule a meeting to debug this as I’m not able to see the same behavior on my end.

---

<div class="post-metadata">

**Author:** ![ind1go](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ind1go/32/46870_2.png) [@ind1go](https://devforum.zoom.us/u/ind1go)\
**Post date:** [March 27, 2023, 11:00pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/19 "2023-03-27T23:00:26Z")

</div>

I had this issue. I wasn’t using ngrok but a cloud provider. By enabling debug logging I was eventually able to see that `cookie-session` wasn’t able to save the cookies because it didn’t believe it was a secure connection - the cloud server was terminating TLS.

I turned on trusting the proxy headers (`app.set('trust proxy', true)`) and now all is good.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 28, 2023, 10:24pm UTC](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998/20 "2023-03-28T22:24:51Z")

</div>

Thanks for sharing your solution here! I’ll look at implementing this in the official repo

[Next page](https://devforum.zoom.us/t/unable-to-run-zoomapps-sample-js/82998.md?page=2)
