serverless-nextjs / serverless-next.js

⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
MIT License
4.44k stars 454 forks source link

The SSG pages throw an error after revalidation #1138

Open ignaciolarranaga opened 3 years ago

ignaciolarranaga commented 3 years ago

Actual behavior

I have a SSG pages deployed to Cloudfront using CDK. The pages are generated correctly the first time, but after the revalidation happen they start failing indicating that a SQS queue is not available (see detail below).

Here is the getStaticProps and getStaticPaths for reference:

export async function getStaticProps(context) {
  let localPoll = await ...

  return {
    props: {
      localPoll,
      router: {
        query: {
          id: context.params.id
        },
        locale: context.locale,
      }
    },
    revalidate: 60 * 60 // Revalidate every hour
  }
}

export async function getStaticPaths() {
  return {
    paths: [],
    fallback: 'blocking'
  }
}

Screenshots/Code/Logs

ERROR   Invoke Error    
{
    "errorType": "AWS.SimpleQueueService.NonExistentQueue",
    "errorMessage": "The specified queue does not exist for this wsdl version.",
    "Type": "Sender",
    "Code": "AWS.SimpleQueueService.NonExistentQueue",
    "Detail": "",
    "name": "AWS.SimpleQueueService.NonExistentQueue",
    "$fault": "client",
    "$metadata": {
        "httpStatusCode": 400,
        "requestId": "ec291cf4-224c-5bd7-972f-45da3f97bd02",
        "attempts": 1,
        "totalRetryDelay": 0
    },
    "stack": [
        "AWS.SimpleQueueService.NonExistentQueue: The specified queue does not exist for this wsdl version.",
        "    at /var/task/index-7e1e3de6.js:1891:68",
        "    at step (/var/task/httpRequest-31970d1c.js:89:23)",
        "    at Object.next (/var/task/httpRequest-31970d1c.js:70:53)",
        "    at fulfilled (/var/task/httpRequest-31970d1c.js:60:58)",
        "    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
    ]
}

Versions

I build the web with:

Specifically:

#!/usr/bin/env node
const { Builder } = require("@sls-next/lambda-at-edge");

// Run the serverless builder, this could be done elsewhere in your workflow
const builder = new Builder('.', '.cdk', { args: [ 'build' ] });

builder.build()
  .then(() => {
    console.log('The build was successful');
  });

And later deploy with the CDK with:

Checklist

dphang commented 3 years ago

From some research it might be a region mismatch e.g in issues like https://github.com/aws/aws-sdk-java/issues/1985. See if maybe your region needs to be properly set?

Maybe @kirkness might know too, I am not personally using CDK in my daily deployments