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

V4 - Plugin Custom Resolution Issues #12508

Closed
austencollins opened this issue May 22, 2024 · 6 comments
Closed

V4 - Plugin Custom Resolution Issues #12508

austencollins opened this issue May 22, 2024 · 6 comments
Assignees

Comments

@austencollins
Copy link
Member

austencollins commented May 22, 2024

When referencing a Plugin in serverless.yml outside of the Service, users are having trouble resolving them if 1) they are referencing a file (e.g. .js) or 2) the plugin might not feature a package.json with a main property.

#12503 (comment)
#12503 (comment)
#12503 (comment)

@austencollins
Copy link
Member Author

Custom plugins reference when using V3
plugins:
../infrastructure/queuer/serverless-fargate-plugin/dist/index.js
When using V4, I had to update, as it's now looking for a package.json. (doco suggests a JS file is fine)
plugins:
./../../infrastructure/queuer/serverless-fargate-plugin
Otherwise I get:
no such file or directory, open '/codebuild/output/srcxxx/src/github.com/xxx/web/node_modules/serverless-lift/package.json'

@richard-stafflink Thanks for the additional info. In V4, we switched to ESM, which likely affected this behavior. Let's see if we can restore it.

@austencollins austencollins changed the title V4 Plugin Resolution Issues V4 - Plugin Custom Resolution Issues May 22, 2024
@austencollins
Copy link
Member Author

For others who are experiencing this problem, please include:

• Your serverless.yml plugin references (we need to see the exact syntax).
• What your directory structure looks like.

@richard-stafflink

This comment was marked as abuse.

@austencollins
Copy link
Member Author

We're looking into not having the behavior change across versions ATM.

@kchecoBasis
Copy link

org: orgABC
app: app123
service: 'merchant'
frameworkVersion: '3'

package:
    individually: true
provider:
    name: aws
    runtime: nodejs18.x
    stage: ${opt:stage, 'dev'}
    region: us-east-1
    memorySize: 1024
    iam:
        role:
            statements: ${file(../../common.serverless.yml):statements}
    vpc: ${file(../../common.serverless.yml):vpc}
    apiGateway:
        restApiId:
            ...

    environment:
        ...

functions:
    ...

plugins:
    - serverless-bundle
    - serverless-offline

custom:
    bundle:
        forceExclude: ${file(../../common.serverless.yml):forceExclude}
        ignorePackages: ${file(../../common.serverless.yml):ignorePackages}
    cronEnabled:
        prod: true

The folder structure

    /
        /node_modules
        /services
            /service1
                ...
                serverless.yml
                package.json
            /service2
                ...
        common.serverless.yml
        package.json

@austencollins
Copy link
Member Author

We've added a few fixes into this in 4.0.26 which reinstates the loading behavior with v3. Closing unless this is still reported to be a problem

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

No branches or pull requests

4 participants