I get this error when trying to access an express.js route I made. It should be able to access a URL and retrieve JSON data but its giving me internal server error 500. I have made sure that it is installed in my package.json but I believe vercel removes it when building. The website is https://summonerscard.com. The repo is https://github.com/jack-pap/Summoners-Card.
Cannot find module 'styled-jsx/style'Require stack:- /var/task/node_modules/next/dist/server/require-hook.js- /var/task/node_modules/next/dist/server/next.jsDid you forget to add it to "dependencies" in `package.json`?Node.js process exited with exit status: 1. The logs above can help with debugging the issue.Api call method
export async function apiCall(apiURL) { try { if (!whiteListSites.some((word) => apiURL.includes(word))) return; const proxyURL = `${PROXY_URL}?url=${encodeURIComponent(apiURL)}`; const response = await fetch(proxyURL); if (!response.ok) { throw new Error(`Network response was not ok ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error(error); throw error; }}index.js
import React, { Component } from "react";import express from "express";import next from "next";import cors from "cors";import bodyParser from "body-parser";import NodeCache from "node-cache";const fetch = (...args) => import("isomorphic-fetch").then(({ default: fetch }) => fetch(...args));const dev = process.env.NODE_ENV !== "production";const app = next({ dev });const port = 3000;const whiteListSites = [ "https://raw.communitydragon.org/", "https://ddragon.leagueoflegends.com/", "api.riotgames.com",];const cache = new NodeCache({ stdTTL: 10000, checkperiod: 120 });app.prepare().then(() => { const server = express(); server.get("/p/:id", (req, res) => { const actualPage = "/post"; const queryParams = { id: req.params.id }; app.render(req, res, actualPage, queryParams); });