I’m trying to integrate @builder.io with NextJs following this documentation:
I’m trying to set the page URL for my home page: http://localhost:3000/
but after saving the slash is added for the beginning /
so it’s: /http://localhost:3000/
My code is:
import React from 'react'
import { builder, BuilderComponent } from '@builder.io/react'
builder.init('e26d3532deff4a8a9528e21f334150fd')
const About = ({ builderPage }) => {
console.log(builderPage)
return (
<div>
{builderPage ? (
<BuilderComponent model="page" content={builderPage} />
) : (
<h1>404 Page not found</h1>
)}
</div>
)
}
About.getInitialProps = async ({ res, req, asPath }) => {
// If there is a Builder page for this URL, this will be an object, otherwise it'll be null
const page = await builder.get('page', { req, res, url: asPath }).promise()
return { builderPage: page }
}
export default About;
And the console.log(builderPage)
returns null
Finally I want to deploy the website to AWS via @sls-next/serverless-component
Please help to solve it. My big client wants to use @builder.id but we need to have it integreted with NextJS and serverless deploy.