:ring_buoy: HELP PLEASE | Wrapping my react POC a...
# ask-a-descoper
t
🛟 HELP PLEASE | Wrapping my react POC application and using the Descope flows. Erroring on build. Resolution issue 404 error. Go Deeper >> Error output
Copy code
lau@Lauras-MBP-29 memberbooking % npm run build

> memberbooking@0.1.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve '@descope/sdk' in '/Users/lau/Desktop/booking/memberbooking/src'
d
Hey @thousands-alarm-31103, if you're using react, I think it should be
@descope/react-sdk
instead. Maybe check your imports?
Did you run into any issues with
npm install
?
t
nope the npm seemed to go fine
message has been deleted
I see the issue, not calling the right sdk
👍🏼 1
d
Can you share where you're importing the SDK in the actual JS file
Yeah ok
t
build still failed… quick screenshare?
I changed it in the app.js file
oh hold on…
moving too fast
yeah ok, quick peer program should get us over this quickly
or do you want me to drop the app.js content here… its not massive
d
I'm actually at a conference right now, but sure if you can drop me the file I can take a look
t
Copy code
import { AuthProvider, Descope, useSession, useUser, useDescope } from '@descope-react/sdk';
import React from 'react';
import Logo from '/Users/lau/Desktop/booking/memberbooking/src/main_logo.png';

const App = () => {
  const { isAuthenticated, isSessionLoading } = useSession();
  const { user, isUserLoading } = useUser();
  const { logout } = useDescope();

  return (
    <div className="App">
      <img src={Logo} alt="member_logo" className="logo" />

      {isSessionLoading || isUserLoading ? (
        <p>Loading...</p>
      ) : isAuthenticated ? (
        <>
          <p>Hello {user.name}</p>
          <div>My Private Component</div>
          <button onClick={logout}>Logout</button>
        </>
      ) : (
        <Descope
          flowId="sign-up-or-in"
          onSuccess={(e) => console.log(e.detail.user)}
          onError={(e) => console.log('Could not log in!')}
          theme="light"
        />
      )}

      <iframe
        src="<https://demo.sevenrooms.com/reservations/theobscureDEMO>"
        width="100%"
        height="1200px"
        title="The Obscure DEMO Reservations"
        style={{ border: 'none', overflow: 'hidden' }}
      />
    </div>
  );
};

const AppRoot = () => {
  return (
    <AuthProvider projectId='P2Of3chsSCHf3C99DkiigKE19flu'>
      <App />
    </AuthProvider>
  );
};

export default AppRoot;
d
And you're getting the same error right when you try to build?
t
yep
d
Oh it's
@descope/react-sdk
t
derp
d
Hopefully that works 🙂
t
success with complaints that make sense 🙂
Copy code
Creating an optimized production build...
Compiled with warnings.

[eslint] 
src/index.js
  Line 2:10:  'AuthProvider' is defined but never used  no-unused-vars
  Line 2:24:  'useDescope' is defined but never used    no-unused-vars
  Line 2:36:  'useSession' is defined but never used    no-unused-vars
  Line 2:48:  'useUser' is defined but never used       no-unused-vars
  Line 3:10:  'Descope' is defined but never used       no-unused-vars

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line
d
Awesome!!
Let me know if you have trouble using any of those 🙂
t
I’ll be back. My goal for today is met which is getting the full end to end POC completed. 🙂
🙌🏼 1
This was super easy btw
d
Good to hear it!