serverless-nextjs/serverless-next.js

The regeneration SQS Queue when setting a domain name as the name for the S3 bucket do not to pass the checks

Open

#1544 opened on Aug 14, 2021

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (3,998 stars) (447 forks)batch import
buggood first issue

Description

Issue Summary

The stack generated has issues with the name of the regeneration queue when setting a domain name as name for the bucket (it doesn't pass the name constraints).

Actual behavior

The stack can not be created

Expected behavior

Be able to create the stack :)

Steps to reproduce

  1. Create an app with some page that needs dynamic regeneration and try to put it on AWS with the CDK Construct.
  2. Set a domain name as the name of the S3 bucket, e.g.:
  s3Props: {
    bucketName: env !== Environment.prod ? `${env}.epolls.io` : 'epolls.io',
   },

Screenshots/Code/Configuration/Logs

Specific error from the CDK:

9:19:35 AM | CREATE_FAILED        | AWS::SQS::Queue                                 | EPollsCloudfrontDe...ationQueueABD5421D
The name of a FIFO queue can only include alphanumeric characters, hyphens, or underscores, must end with .fifo suffix and be 1 to 8
0 in length. (Service: AmazonSQS; Status Code: 400; Error Code: InvalidParameterValue; Request ID: d26ec13c-e9d4-5fab-9668-98ad5ec33
7d3; Proxy: null)

        new Queue (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/@aws-cdk/aws-sqs/lib/queue.ts:277:19)
        \_ new NextJSLambdaEdge (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/@sls-next/cdk-construct/src/index.ts:10lowing resource(s) failed to create: [LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB, CustomCDK
5:32)
        \_ EPollsStack.initializeWebCloudfront (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/lib/EpollsStack.ts:838:28)
        \_ new EPollsStack (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/lib/EpollsStack.ts:108:35)
        \_ Object.<anonymous> (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/bin/epolls.ts:9:15)
        \_ Module._compile (internal/modules/cjs/loader.js:1158:30)
        \_ Module.m._compile (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/ts-node/src/index.ts:1056:23)
        \_ Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
        \_ Object.require.extensions.<computed> [as .ts] (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/ts-node/src/in
dex.ts:1059:12)
        \_ Module.load (internal/modules/cjs/loader.js:1002:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:901:14)
        \_ Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
        \_ main (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/ts-node/src/bin.ts:198:14)
        \_ Object.<anonymous> (/Users/ignacio/Workspaces/EPolls/epolls/epolls-backend/node_modules/ts-node/src/bin.ts:288:3)
        \_ Module._compile (internal/modules/cjs/loader.js:1158:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
        \_ Module.load (internal/modules/cjs/loader.js:1002:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:901:14)
        \_ Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
        \_ internal/main/run_main_module.js:18:47

Generated stack:

  EPollsCloudfrontDevPublicAssets9A4B1D80:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: dev.epolls.io
    UpdateReplacePolicy: Delete
    DeletionPolicy: Delete
    Metadata:
      aws:cdk:path: EPollsStackDev/EPollsCloudfrontDev/PublicAssets/Resource
  ...
  EPollsCloudfrontDevRegenerationQueueABD5421D:
    Type: AWS::SQS::Queue
    Properties:
      FifoQueue: true
      QueueName:
        Fn::Join:
          - ""
          - - Ref: EPollsCloudfrontDevPublicAssets9A4B1D80
            - .fifo
    UpdateReplacePolicy: Delete
    DeletionPolicy: Delete
    Metadata:
      aws:cdk:path: EPollsStackDev/EPollsCloudfrontDev/RegenerationQueue/Resource

Versions

  • @sls-next/cdk-construct: 3.2.1-alpha.0 (and 3.2.0),

Additional context

N/A

Contributor guide