Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

"hostname" and "port" must be provided when starting next to use "unstable_revalidate" #2402

Open
3 tasks done
marconucara opened this issue Mar 14, 2022 · 5 comments
Open
3 tasks done

Comments

@marconucara
Copy link

Issue Summary

I want to use req.unstable_revalidate for ISG. Reading here it seems supported.

Actual behavior

If I call req.unstable_revalidate inside an api I got this error:

"hostname" and "port" must be provided when starting next to use "unstable_revalidate". See more here https://nextjs.org/docs/advanced-features/custom-server

I can't get any actual information about this problem at the provided url.
Also, checking the code generated inside .next/serverless/chunk/ I don't think I can pass hostname and port parameters, because the function accept only one parameter:

apiRes.unstable_revalidate = (urlPath)=>unstable_revalidate(urlPath, req, apiContext)

Looking for the round of calls that are made previously, I don't even seem to be able to modify this apiContext.

(Locally works fine)

Versions

  • OS/Environment: macOS 12.2.1
  • @sls-next/serverless-component version: v3.7.0-alpha.11
  • Next.js version: 12.1

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible. As there is only one maintainer (who maintains this in his free time) and thus very limited resources, if you have time, please try to debug the issue a bit yourself if possible.
  • You have first tried using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.
@agnese-kerubina
Copy link

AFAIK base ISR feature is working where you add the revalidate prop to getStaticProps. If you are referring to 12.1 release's On-demand Incremental Static Regeneration, it should not be working.

@thmohd
Copy link

thmohd commented Mar 23, 2022

So this happen to me if I am using a custom server, if you do then make sure you have
const app = next({ dev, hostname, port }) with hostname and port

check https://nextjs.org/docs/advanced-features/custom-server for more info

@marconucara
Copy link
Author

marconucara commented Mar 23, 2022

@thmohd I am using Serverless Stack (sst) which uses serverless-next.js, maybe I should open an issue to them? Can you confirm that ISG with unstable_revalidate should work on the serverless-next.js side?

(I do not create any custom server and it is not clear to me if the custom server is created by sst or by serverless-next.js)

@chandank-nu
Copy link

AFAIK base ISR feature is working where you add the revalidate prop to getStaticProps. If you are referring to 12.1 release's On-demand Incremental Static Regeneration, it should not be working.

Hi, Do you know if there is any plan to add this feature?

@Lea23VC
Copy link

Lea23VC commented Nov 22, 2022

AFAIK base ISR feature is working where you add the revalidate prop to getStaticProps. If you are referring to 12.1 release's On-demand Incremental Static Regeneration, it should not be working.

Hi, Do you know if there is any plan to add this feature?

Any update?, trying to use On-demand ISR gives me "Invariant: required internal revalidate method not passed to api-utils"

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

No branches or pull requests

5 participants