Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hitting public URL for next.js (launchpad) throws errors ( #36

Open
cognitiaclaeves opened this issue Feb 24, 2025 · 0 comments
Open

hitting public URL for next.js (launchpad) throws errors ( #36

cognitiaclaeves opened this issue Feb 24, 2025 · 0 comments
Assignees

Comments

@cognitiaclaeves
Copy link

Fix

Describe your request

Unable to run Launchpad from fresh clone of repo. Get an "empty" screen (see screenshot of source below) and

I'm unsure how to be concise about my request -- I want it to run like it does when I launch a demo from strapi's site. But I tried to be very detailed with the error information and configuration.

Steps to reproduce the behavior

  1. git clone launchpad
  2. Go through steps to build / seed / run strapi for launchpad
  3. (fix DB error when importing data)
  4. Go through steps to build / run next.js UI
  5. Create vhost file like below (It's headless; I can't hit directly in a meaningful way)
  6. Reload nginx
  7. See errors below

Expected behavior

I was hoping to have a personal working version of Launchpad that I could reference as I build out my project.

Screenshots

Output of build/run:

someone@somewhere4g-ub-ash-1-strapi-1:/mnt/data/proj/Strapi-LaunchPad/next$ yarn && yarn build && yarn start
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.25s.
yarn run v1.22.22
$ next build
  ▲ Next.js 14.2.5

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /_not-found                          875 B          88.3 kB
├ ƒ /[locale]                            641 B           469 kB
├ ƒ /[locale]/[slug]                     641 B           469 kB
├ ƒ /[locale]/blog                       2.41 kB         116 kB
├ ƒ /[locale]/blog/[slug]                1.56 kB         470 kB
├ ƒ /[locale]/products                   1.5 kB          101 kB
├ ƒ /[locale]/products/[slug]            3.26 kB         471 kB
├ ƒ /[locale]/sign-up                    3.21 kB         134 kB
└ ƒ /api/preview                         0 B                0 B
+ First Load JS shared by all            87.4 kB
  ├ chunks/23-b99bfd736878e5f6.js        31.7 kB
  ├ chunks/fd9d1056-c2e4105da5bede26.js  53.6 kB
  └ other shared chunks (total)          2.11 kB


ƒ Middleware                             35.2 kB

○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand

Done in 24.43s.
yarn run v1.22.22
$ next start
  ▲ Next.js 14.2.5
  - Local:        http://localhost:3000

 ✓ Starting...
 ✓ Ready in 330ms
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async d (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/app/[locale]/(marketing)/page.js:1:4096) {
  code: 'ERR_INVALID_URL',
  input: 'api/pages'
}
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async P (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:13112) {
  code: 'ERR_INVALID_URL',
  input: 'api/global'
}
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async Module.N (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:12951) {
  code: 'ERR_INVALID_URL',
  input: 'api/global'
}
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async Module.l (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/app/[locale]/(marketing)/page.js:1:3940) {
  code: 'ERR_INVALID_URL',
  input: 'api/pages'
}
TypeError: Cannot read properties of undefined (reading 'localizations')
    at d (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/app/[locale]/(marketing)/page.js:1:4170) {
  digest: '1005730644'
}
TypeError: Cannot read properties of undefined (reading 'navbar')
    at P (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:13354) {
  digest: '1440318454'
}
TypeError: Cannot read properties of undefined (reading 'navbar')
    at P (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:13354) {
  digest: '1440318454'
}
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async Module.N (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:12951) {
  code: 'ERR_INVALID_URL',
  input: 'api/global'
}
FetchContentTypeError TypeError: Invalid URL
    at new URL (node:internal/url:806:29)
    at n (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/chunks/401.js:1:15444)
    at async Module.l (/mnt/data/proj/Strapi-LaunchPad/next/.next/server/app/[locale]/(marketing)/page.js:1:3940) {
  code: 'ERR_INVALID_URL',
  input: 'api/pages'
}

Screenshot of UI:

Image

Additional context

Running headless on hetzner server (cpx21 3VCPU, 4GB);
Ubunutu 24.04.2 LTS
$ node --version && npm --version && node --version
v20.18.3
11.1.0
v20.18.3
through nginx with a wildcard DNS (I'm including the vhost file because I barely got it working):

The intent is to run several strapi instances, including a multi-tenant instance, and possibly their UIs on the same server. The traffic is expected to be pretty low-volume. Mainly I'm giving a home on the net to mom after she was banned from FB marketplace's AIs.

# strapi-lp.somewhere.com
upstream strapi-lp.somewhere.com {
  server 127.0.0.1:1400;
  keepalive 64;
}

server {
  listen 443 ssl; #http2;
  listen [::]:443 ssl; #http2;

  # use when not enforcing https, otherwise, uncomment serverblock for redirect from port 80:
  # listen 80;

  server_name strapi-lp.somewhere.com  www.strapi-lp.somewhere.com;
  access_log /var/log/nginx/strapi-launchpad.somewhere.com-access.log;
  error_log /var/log/nginx/strapi-launchpad.somewhere.com-error.log;
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://strapi-lp.somewhere.com;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_cache_bypass $http_upgrade;
  }

  ssl_certificate /etc/letsencrypt/live/somewhere.com-0001/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/somewhere.com-0001/privkey.pem;
  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

# uncomment when enforcing https
# comment when testing locally on port 80
server {
  listen 80;
  listen [::]:80;
  server_name strapi-lp.somewhere.com;
  return 301 https://$host$request_uri;
  # return 404;
}

If it would help troubleshooting/is needed, I can get move this to a domain that I don't mind sharing with bots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants