https://serverless-stack.com/ logo
#help
Title
# help
p

Pavan Kumar

01/20/2022, 5:57 PM
I am getting following error from my NestjsSite, when tried to access SSR page. I am not sure what I am doing wrong. Here is the error. (Url for the page which gives error https://d2qdtx7ws5h5vx.cloudfront.net/events/event1)
Copy code
503 ERROR
The request could not be satisfied.
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront)
Request ID: RRTOBh45Cnnslf2dj35V0o8Iylx_gSXhlaxW0ibLRc3H5qkHkUq6tw==
Here is the code for the page.
Copy code
// pages/events/[events].tsx

import type { GetServerSideProps, NextPage } from 'next'
import styles from '../../styles/Home.module.css'

export const getServerSideProps: GetServerSideProps = async (context) => {
  return {
    props: {
      event: context.params?.event,
    },
  }
}

type Props = {
  event: string,
}

const Home: NextPage<Props> = ({ event}) => {
  return (
    <div className={styles.container}>
      <h1>Event Page</h1>
      <p>Event {event}</p>
    </div>
  )
}

export default Home
I was able to find the cloudwatch logs. Not sure what's the fix.
Copy code
{
  "errorType": "Error",
  "errorMessage": "Cannot find module '../../../webpack-runtime.js'\nRequire stack:\n- /var/task/pages/events/[event]/[hotel].js\n- /var/task/default-handler-b3f3c1c7.js\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "code": "MODULE_NOT_FOUND",
  "requireStack": [
    "/var/task/pages/events/[event]/[hotel].js",
    "/var/task/default-handler-b3f3c1c7.js",
    "/var/task/index.js",
    "/var/runtime/UserFunction.js",
    "/var/runtime/index.js"
  ],
  "stack": [
    "Error: Cannot find module '../../../webpack-runtime.js'",
    "Require stack:",
    "- /var/task/pages/events/[event]/[hotel].js",
    "- /var/task/default-handler-b3f3c1c7.js",
    "- /var/task/index.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:667:27)",
    "    at Module.require (internal/modules/cjs/loader.js:887:19)",
    "    at require (internal/modules/cjs/helpers.js:74:18)",
    "    at /var/task/pages/events/[event]/[hotel].js:315:27",
    "    at Object.<anonymous> (/var/task/pages/events/[event]/[hotel].js:321:3)",
    "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
    "    at Module.load (internal/modules/cjs/loader.js:863:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)"
  ]
}
@Frank Looks like bug with NextjsSite! Not uploading webpack-runtime.js file with Lamba code.
f

Frank

01/24/2022, 10:10 PM
Hey @Pavan Kumar, missed your msg earlier. Btw which version of Nextjs r u using?
p

Pavan Kumar

01/25/2022, 3:38 AM
Hey @Frank I am using next 12.0.8
f

Frank

02/18/2022, 4:36 AM
Hey @Pavan Kumar, we made some changes to how the
NextjsSite
construct work in v0.63.0. That should’ve fixed this issue.
p

Pavan Kumar

02/18/2022, 3:12 PM
Thanks @Frank , will try it out.
4 Views