Most of the answers I look at on Stackoverflow mentioned checking the correct config variables like:
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
NEXTAUTH_URL
I made sure that all the values are correct. Same code works perfectly in local, but in production I keep getting callback error.
I also made sure that I used the right callback uri's in Google Console with my domain.
Please find the below screenshots of Vercel Console and Google API Console. What else am I missing here?
enter image description here
In the documentation for the gitlab api, it tells you how to get the notes for a snippet in a particular project by doing:
GET /projects/:id/snippets/:snippet_id/notes
However, this does not work for snippets that the user has created that do not belong to a particular project (i.e. those in /dashboard/snippets).
Is there a way to get the comments on these snippets using the gitlab api as well? I could not find anything in the snippets API docs either.
It's not documented, but you can access snippets without a project just by altering the endpoint:
Instead of GET /projects/:id/snippets/:snippet_id/notes try /snippets/:snippet_id/notes. Everything else about interacting with snippets appears to be the same, just the endpoint changes.
I've set a custom server from the example but, my question is...
Can the server code access the NextJs code?
I mean, NextJs is built with webpack, therefore packed in its own context, so if I want to initialize something (let's say, database, logging system, etc.) in the server before NextJs has started, and then access it from NextJs... is it possible? I don't see how unless server code and NextJs code are in the same bundle, is it?
Yes, I guess there are some hacks that can be used, like importing files in runtime with __non_webpack_require__... but that seems like a hack (?) and only in one direction.
Any other better option?
If you use SSR in NextJS, you can access to APIs before rendering.
https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props
If you export a function called getServerSideProps (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data returned by getServerSideProps.
It fetches your data upon a user requesting your website everytime.
Thatmeans no matter what you build first on your server. Next.js will fetch for it every time. The comment above me sent the correct link. https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props
TO view all data fetching techniques from next.js visit: https://nextjs.org/docs/basic-features/data-fetching/overview
PLease comment back to this to see if this helped, or if we missunderstood the question, so that we can help solve this issue, or if you resolved it. happy coding!
I'm trying to serve my next.js with AWS Lambda as serverless.
and I've encountered trouble about dynamic routing.
My directory is like below that.
pages
-courses
-[id].jsx
-index.jsx
-index.jsx
It works well on my local server.
But on my Real server(AWS Cloudfront), it doesn't support dynamic routing.
The problem is about courses/[id].jsx.
When I entered my website, I can see an error message on the console.
GET https://RANDOM.cloudfront.net/_next/static/RANDOM/pages/courses/[id].js net::ERR_ABORTED 400
So, I changed the name [id].jsx to id.jsx and I built and deploy it.
and it works.
But I'm not sure it is the correct way to solve my problem.
because nextjs says using [] with dynamic routing.
My question is that is my solution naming without [] is proper or no problem?
and If I am wrong how can I fix it?
I am trying to connect to Facebook through the API but it is giving me an error of Type:
FacebookUser is not defined in vb file.
I have tried with namespaces but it is not working.
what should I do?
Make sure FacebookUser.api is inside the handler. If possible to post part of code would be better to identify the issue.