picsoung
picsoung
PD🧩 Plasmo Developers
Created by picsoung on 10/3/2023 in #👟framework
Using NextJS API routes works in dev but not in prod
Hi folks, Thank you for building this awesome framework. I followed the next js example to get started. I was able to build a great extension (I think). I need to make outside API calls, so I created some API routes under /src/pages/api And I can call them by making an "internal API call" from the client GET $PLASMO_PUBLIC_NEXT_URL/api/something This works great in dev. the value of PLASMO_PUBLIC_NEXT_URL in .env.developemnt is localhost:1947 and same in .env.production in the manifest I have
"manifest": {
"host_permissions": [
"https://*/*",
"$PLASMO_PUBLIC_NEXT_URL/*"
]
"manifest": {
"host_permissions": [
"https://*/*",
"$PLASMO_PUBLIC_NEXT_URL/*"
]
But once I package my app and try the prod version, I get errors Failed to fetch Any idea why? Is the nextjs port different in prod? Thank you
3 replies