Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Combine serverless-next.js CF distribution with other distributions denies access on S3 #2594

@bragaru-i

Description

@bragaru-i

Issue Summary

We have a combined project, where we use 2 CF distributions (for nextjs serverless and for artifacts from CRA ).
Howewer, we have a route in CRA distribution, where we want to be linked by defaultLambda from nextJs.

Eg: CRA distribution's behavior, where we link to nextJs defaultLambda
image

defaultLambda has all the S3 roles/permissions enabled on all resources

Actual behavior

  • Denied Access
2023-03-07T13:31:13.120Z	2dd9620a-dd8c-4187-97d9-50c523bbeabb	ERROR	Invoke Error 	{
    "errorType": "AccessDenied",
    "errorMessage": "Access Denied",
    "trace": [
        "AccessDenied: Access Denied",
        "    at S3ServiceException.ServiceException [as constructor] (/var/task/default-handler-0a0dc009.js:84383:28)",
        "    at new S3ServiceException (/var/task/default-handler-0a0dc009.js:97935:28)",
        "    at /var/task/default-handler-0a0dc009.js:99474:28",
        "    at step (/var/task/default-handler-0a0dc009.js:83718:23)",
        "    at Object.next (/var/task/default-handler-0a0dc009.js:83699:53)",
        "    at fulfilled (/var/task/default-handler-0a0dc009.js:83689:58)",
        "    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
    ]
}

Expected behavior

  • Passing the S3 errors

Screenshots/Code/Configuration/Logs

Versions

  • OS/Environment: Ubuntu 22.04
    "dependencies": {
        "@sls-next/aws-cloudfront": "3.7.0",
        "@sls-next/aws-lambda": "3.7.0",
        "@sls-next/aws-sqs": "^3.7.0",
        "@sls-next/domain": "^3.7.0",
        "@sls-next/serverless-component": "3.7.0",
        "next": "^12.3.4",
        "next-images": "1.8.4",
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "typescript": "4.9.5"
    },

Additional context

serverless settings:
image

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible. As there is only one maintainer (who maintains this in his free time) and thus very limited resources, if you have time, please try to debug the issue a bit yourself if possible.
  • You have first tried using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions