question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UserSession.completeOAuth2 error in production React app

See original GitHub issue

I get the following error when attempting to complete an authentication using UserSession.completeOAuth2:

TypeError: o.opener.parent[("__ESRI_REST_AUTH_HANDLER_" + z)] is not a function
    at r (UserSession.js:181)
    at Function.e.completeOAuth2 (UserSession.js:222)
    at auth.js:41
    at c (runtime.js:45)
    at Generator._invoke (runtime.js:264)
    at Generator.e.<computed> [as next] (runtime.js:98)
    at t (asyncToGenerator.js:3)
    at z (asyncToGenerator.js:25)
    at asyncToGenerator.js:32
    at new Promise (<anonymous>)

The app is built off of React (CRA) and is using the latest arcgis-rest packages (2.0.3). It works with no errors in local but fails with this error when deployed to the production site. I am passing a URL parameter through the redirect which I’m not sure is affecting things (popup is set to false).

Even though it fails here and halts the app I can copy/paste the redirect URL that it produces into a new tab and the authentication goes through with no errors.

I’m stumped.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tomwaysoncommented, Jun 7, 2019

FYI - this CRA (react-scripts@3.0.0) app uses arcgis-rest-js v2.0.3 and the log in works in prod mode:

https://create-arcgis-app.surge.sh/

Here’s the source:

https://github.com/tomwayson/create-arcgis-app/

0reactions
tomwaysoncommented, Jan 30, 2020

I’m going to consider this fixed btw #625 and #652. If anyone experiences this issue again, feel free to re-open.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error occured in react.production.min.js after deploying react ...
so here is the answer of this question! in package.json, i moved react and react-dom to peerDependencies "peerDependencies": { "react": ...
Read more >
Adding login authentication to secure React apps
Learn how to secure your React app by implementing basic server-side login authentication for an Express.js server.
Read more >
Solved: Use the BeginOAuth2 without a popup - Esri Community
Solved: I am trying to include user authentication into a webpage. I want to use `BeginOAuth2` method from the rest-js library.
Read more >
Error Boundaries - React
These errors were always caused by an earlier error in the application code, but React did not provide a way to handle them...
Read more >
Experience with Frontend Error Tracking Using Sentry.io In ...
Sign In and create a project Integrate Sentry in app First error ... we are interested in real time error tracking in production...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found