Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not deploy assets to aws with serverless-lift plugin using V4 #12797

Open
MrMySQL opened this issue Sep 11, 2024 · 1 comment
Open

Can not deploy assets to aws with serverless-lift plugin using V4 #12797

MrMySQL opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels

Comments

@MrMySQL
Copy link

MrMySQL commented Sep 11, 2024

Issue description

when using server less v4 (any version) when trying to upload some assets to aws with a pretty default template, I get an error: Cannot destructure property 'name' of 'undefined' as it is undefined at _Progress.create (file:///Users/mrmysql/.serverless/releases/4.1.23/package/dist/sf-core.js:76:1138)

While with serverless v3 everything is ok.

constructs:
    website:
        type: server-side-website
        assets:
            '/css/*': public/css
            '/js/*': public/js

public/css and public/js contain files.

Here is the full output:

✗ serverless website:assets:upload

(node:45842) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
Deploying the assets for the 'website' website


✖ Cannot destructure property 'name' of 'undefined' as it is undefined.
TypeError: Cannot destructure property 'name' of 'undefined' as it is undefined.
    at _Progress.create (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:76:1138)
    at _ServerSideWebsite.uploadAssets (/Users/mrmysql/projects/test/node_modules/serverless-lift/dist/src/constructs/aws/ServerSideWebsite.js:209:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async _ServerSideWebsite.uploadAssetsCommand (/Users/mrmysql/projects/test/node_modules/serverless-lift/dist/src/constructs/aws/ServerSideWebsite.js:191:5)
    at async PluginManager.runHooks (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:9309)
    at async PluginManager.invoke (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:10080)
    at async PluginManager.run (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:10811)
    at async Serverless.run (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:920:10612)
    at async runFramework (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:943:2670)
    at async route (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:966:29270)

For help, try the following:
  • Run the command again with the "--debug" option
  • Run "serverless support"
  • Review the docs: https://www.serverless.com/framework/docs/

Context

✗ serverless support --summary

(node:47852) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Serverless ϟ Support

This generates a report from your last Serverless Framework command (including any errors) to use for Github Issues, debugging w/ AI, or creating a support ticket w/ Serverless Inc.

Summary Report -----------------

Service Overview

  • Serverless Framework Version: 4.3.2
  • Service Path: /Users/mrmysql/projects/test
  • Service Config File: serverless.yml
  • Service Name: symfony
  • Service Runtime: provided.al2
  • Service Stage: dev
  • Service Region: us-east-1
  • Command: website:assets:upload

Error Message

Cannot destructure property 'name' of 'undefined' as it is undefined.

Error Stacktrace

at _Progress.create (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:76:1138)
at _ServerSideWebsite.uploadAssets (/Users/mrmysql/projects/test/node_modules/serverless-lift/dist/src/constructs/aws/ServerSideWebsite.js:209:33)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async _ServerSideWebsite.uploadAssetsCommand (/Users/mrmysql/projects/test/node_modules/serverless-lift/dist/src/constructs/aws/ServerSideWebsite.js:191:5)
at async PluginManager.runHooks (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:9309)
at async PluginManager.invoke (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:10080)
at async PluginManager.run (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:913:10811)
at async Serverless.run (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:920:10612)
at async runFramework (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:943:2670)
at async route (file:///Users/mrmysql/.serverless/releases/4.3.2/package/dist/sf-core.js:966:29270)

Service Config

# Read the documentation at https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
service: symfony
provider:
    name: aws
    # The AWS region in which to deploy (us-east-1 is the default)
    region: us-east-1
    # The stage of the application, e.g. dev, production, staging… ('dev' is the default)
    stage: dev
    runtime: provided.al2
    environment:
        # Symfony environment variables
        APP_ENV: dev
plugins:
  - ./vendor/bref/bref
  - serverless-lift
functions:
    # This function runs the Symfony website/API
    web:
        handler: public/index.php
        timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
        layers:
            - ${bref:layer.php-82-fpm}
        events:
            - httpApi: '*'
    # This function let us run console commands in Lambda
    # console:
    #     handler: bin/console
    #     timeout: 120 # in seconds
    #     layers:
    #         - ${bref:layer.php-82} # PHP
    #         - ${bref:layer.console} # The "console" layer
package:
    patterns:
        # Excluded files and folders for deployment
        # - '!assets/**'
        - '!node_modules/**'
        # - '!public/build/**'
        # - '!tests/**'
        - '!var/**'
        # If you want to include files and folders that are part of excluded folders,
        # add them at the end
        - 'var/cache/prod/**'
        # - 'public/build/entrypoints.json'
        # - 'public/build/manifest.json'
constructs:
    website:
        type: server-side-website
        assets:
            '/css/*': public/css
            '/js/*': public/js
            # add here any file or directory that needs to be served from S3

Service Overview

  • Serverless Framework Version: 4.3.2
  • Command: support --summary true
@MrMySQL MrMySQL changed the title Can not deploy assets with serverless-lift plugin in V4 Can not deploy assets to aws with serverless-lift plugin using V4 Sep 11, 2024
@skierkowski skierkowski added the V4 label Sep 11, 2024
@nolotz
Copy link

nolotz commented Sep 14, 2024

Hi there,

In addition to the issue within website:assets:upload, I’ve noticed this also occurs during deployment and in any other instances where the ServerSideWebsite uploadAssets function is called. It seems that ServerlessUtils's progress.create() now expects an argument to be passed.

I was able to apply a local hotfix by modifying Lift's ServerSideWebsite uploadAssets() function from

uploadProgress = progress.create();

to

uploadProgress = progress.create({
    message: 'Uploading assets'
});

Since Lift currently relies on serverless@3, it might make sense for this to be addressed on Lift's side.

You can find the relevant code here: https://github.com/getlift/lift/blob/08772c56cc219ca7fa65cc4ff7c4dfea20246a70/src/constructs/aws/ServerSideWebsite.ts#L242

Cheers,
Noah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants