Next.js Discord

Discord Forum

Works on npm run dev not in npm start

Unanswered
American Chinchilla posted this in #help-forum
Open in Discord
American ChinchillaOP
My Nextjs app has a api route.ts .. api/add-user and that folder has route.ts .. when I call and make a fetch request it works in development but not in production ..

31 Replies

what do you mean by "not working"? @American Chinchilla
American ChinchillaOP
@James4u like it's throwing catch error
can you show me the error log?
American ChinchillaOP
Internal server error
anyway you are not getting 404 right?
you should be able to see the server error in your console
American ChinchillaOP
Like I see internal error when I deployed it to AWS amplify and responded with 404 when I req directly to amplify url .. in npm start I get no error log all seems fine with response.ok but no change to db .. api route.ts is db CRUD
by npm run start did you mean deploying to AWS?
just try npm run build & npm run start on your local and see what's hapenning
American ChinchillaOP
npm run start in local pc
so? what's happening?
American ChinchillaOP
Api not throwing any error but nothing changed .. like in db .
All works fine in npm run dev
@American Chinchilla
hey man, am asking what's happening when you try npm run start in your local
not npm run dev
American ChinchillaOP
In npm run start ...the app is not throwing any error
American ChinchillaOP
Yes
show me your code
which DB are you using? and which ORM?
American ChinchillaOP
Can't at this point .. I am not near my pc .. will shortly send
Db is dynamoDB
my suspections are like
- Maybe envs are missing in your production so that you can't acess to the db?
- You are also missing some exception handling and that's why you don't see any error messages there?
American ChinchillaOP
@James4u the things is that the I make a req to an endpoint api/customer-list to get all the customer details .. that work on all like development and production and in amplify but other api/ req are not working. If all endpoint is not working then it's a route issue but one work not rest of them .
And env are all good
@American Chinchilla shoe me your code then
who can imagine your bug without reading the code do you think?
American ChinchillaOP
I get it
Like I said am afk .. so as soon as I reach home I will send the code
I will keep you updated