saas icon indicating copy to clipboard operation
saas copied to clipboard

Chapter 3 - SaaS Boilerplate

Open infamousricky opened this issue 2 years ago • 6 comments

Ran into an issue with the fetching of user-name because the API documentation references the APP_URL in the environment file but couldn't find a .env file in /3-being/app

const response = await fetch( ${process.env.URL_APP}${path}${qs}, Object.assign({ method: 'POST', credentials: 'include' }, opts, { headers }), );

infamousricky avatar Jun 22 '22 16:06 infamousricky

Thanks @infamousricky . I'm not sure where you are at in Chapter 3, but at some point, we give the following instruction:

Open your .env file. Make sure that you have values for:

URL_APP=http://localhost:3000
PORT_APP=3000

Let me know if the code works for you once you add those environmental variables to your .env file.

klyburke avatar Jun 22 '22 23:06 klyburke

I ran into a similar issue where I was experiencing undefined when the app runs, it would redirect to: (http://localhost:3000/undefined/login) and displayed an undefined(404) view. I realized this specific error was occurring because I had already run a previous app instance and the chrome cache stored the session. So each time I ran the application, it was attempting to access an active session user signed session. Stopping the server and app and clearing the cache worked for me.

RileyManda avatar Jun 29 '22 12:06 RileyManda

@klyburke Are you able to reproduce redirect to http://localhost:3000/undefined/login?

tima101 avatar Jul 03 '22 04:07 tima101

Sorry for the delay!

I never noticed this problem when testing each of the book chapter codebases for saas.

Now I just tested running the main saas app. I logged in, stopped the application, then ran it again. I don't see any redirect to http://localhost:3000/undefined/login.

@RileyManda are you able to reproduce this issue? If so, which codebase and can you give exact steps to reproduce the issue? Thanks!

klyburke avatar Jul 12 '22 02:07 klyburke

I am currently using the Saas code base.Not the book code base.Not sure if this might be the wrong thread for my issue but these are the steps i took:

1:git clone 2:cd app and cd'd into api: 3:Upgraded the node and yarn engines to the latest version:For both the app and api directory.

  "engines": {
    "node": "16.15.0",
    "yarn": "1.22.19"
  },

Installed dependencies for the api and app:yarn: Yarn dev produces the following output in the app directory:

rileymanda@Riley app % yarn dev yarn run v1.22.19 $ nodemon server/server.ts [nodemon] 2.0.15 [nodemon] to restart at any time, enter rs[nodemon] watching path(s): server/**/* [nodemon] watching extensions: ts [nodemon] startingts-node --project tsconfig.server.json server/server.ts` info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled wait - compiling... event - compiled client and server successfully in 2.3s (609 modules)

Ready on undefined wait - compiling /_error (client and server)... wait - compiling... event - compiled client and server successfully in 587 ms (610 modules) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11) TypeError: Only absolute URLs are supported at getNodeRequestOptions (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:61917) at /Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63448 at new Promise () at Function.fetch [as default] (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/dist/compiled/node-fetch/index.js:1:63382) at fetchWithAgent (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/node-polyfill-fetch.js:17:17) at sendRequestAndGetResponse (webpack-internal:///./lib/api/sendRequestAndGetResponse.ts:26:26) at getUserApiMethod (webpack-internal:///./lib/api/public.ts:11:107) at Function.MyApp.getInitialProps (webpack-internal:///./pages/_app.tsx:177:80) at async Object.loadGetInitialProps (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/shared/lib/utils.ts:354:17) at async Object.renderToHTML (/Users/rileymanda/Documents/dev/TestSaas/saas/saas/app/node_modules/next/server/render.tsx:899:11)`

And this is what i get in the browser:

Screen Shot 2022-07-12 at 3 08 55 PM

Manually editing the url by removing undefined produced the following output:

Screen Shot 2022-07-12 at 3 10 49 PM

RileyManda avatar Jul 12 '22 13:07 RileyManda

@RileyManda Thanks for the details! I will try to follow and see if I can reproduce what you see.


@RileyManda I tested as you described but did not get the same output. The code runs without issue for me.

(1) Make sure you have pulled the latest code from GitHub, since we pushed a major update a few weeks ago.

(2) Try deleting your yarn.lock file and node_modules folder in the app project and then re-run yarn. That will create a new yarn.lock file and node_modules folder based on your package.json. Then try running app again with yarn dev.

(3) If you still see an issue, please feel free to create a public GitHub repo with the code you are running. Then I can run exactly what you are running and see if the error comes up.

Thanks again for reporting!

klyburke avatar Jul 18 '22 02:07 klyburke

Hi, programming is a cool topic, I would like to learn it too, but I don't have much time, unfortunately I can't learn programming now, because I don't have time for it, but for my project I want to use the services of https://evnedev.com/services/saas-application-development-company/ Maybe they can help me, you guys are good at it, would love to hear your thoughts

JohnyBay3 avatar Feb 14 '23 20:02 JohnyBay3