Next.js Discord

Discord Forum

I deployed my program to production and it doesnt work, even though it did in dev server (local)

Unanswered
Great Gray Owl posted this in #help-forum
Open in Discord
Great Gray OwlOP
I deployed my program it works just fine in the dev server but then when I put it into production, deploys. however, it does not work when loading the page. This is urgent its supposed to be in production by the end of the week.

I am using Netlify

Error:
Aug 12, 12:17:47 PM: b6929ed7 ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: file.startsWith is not a function","reason":{"errorType":"TypeError","errorMessage":"file.startsWith is not a function","stack":["TypeError: file.startsWith is not a function"," at promises.readFile (/var/task/.netlify/functions-internal/___netlify-odb-handler/handlerUtils.js:98:18)"," at getSource (node:internal/modules/esm/load:43:20)"," at defaultLoad (node:internal/modules/esm/load:111:38)"," at ModuleLoader.load (node:internal/modules/esm/loader:417:13)"," at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:288:22)"," at new ModuleJob (node:internal/modules/esm/module_job:63:26)"," at #createModuleJob (node:internal/modules/esm/loader:312:17)"," at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:265:34)"," at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:251:17)"," at async ModuleLoader.import (node:internal/modules/esm/loader:336:23)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: file.startsWith is not a function"," at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:529:35)"," at emit (node:internal/process/promises:149:20)"," at processPromiseRejections (node:internal/process/promises:283:27)"," at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}Aug 12, 12:17:47 PM: Unknown application error occurred
Runtime.Unknown

7 Replies

Great Gray OwlOP
images
function log ^
Japanese jack mackerel
you're attempting to call the startsWith method on a variable named file, but this variable is not a string. The startsWith method is a string method, and it will throw a TypeError if you try to use it on a non-string value.
@Great Gray Owl images
Spectacled bear
Can you try running a build (production version) locally?
Great Gray OwlOP
so actually i got this solved! I moved over to vercel and did two things
yarn upgrade
and update next, it was outdated and that’s what has been giving me the error apparently
i’m on phone so i can’t mark this as solved lol
Spectacled bear
Can you mark this as answered?