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

Unable to deploy mixed language Serverless environments due to ENOENT: no such file or directory #832

Closed
ryan-maclaurin-group opened this issue May 17, 2021 · 4 comments
Milestone

Comments

@ryan-maclaurin-group
Copy link

This is a Bug Report

Description

Starting in versions 5.4.0 and up to the current release 5.5.0 it does not appear to be possible to deploy a mixed language Serverless environment due to the "copyExistingArtifacts" function including non-javascript functions. When attempting to run a deploy you get the following error:

ENOENT: no such file or directory, copyfile '/...../.webpack/<function>.zip' -> '.serverless/<function>.zip'

In our use case we have a mix of Node12 and Java11 code being deployed to different AWS lambda functions. The Node12 functions are being handled by webpack while Java11 is being handled by Maven outside of the Serverless execution.

For bug reports:

  • What went wrong?
    Encounter the above mentioned error when attempting to deploy a mix of Node and Java Serverless functions.

  • What did you expect should have happened?
    Serverless-Webpack should be ignoring the Java functions instead of trying to copy a non-existent artifact.

  • What was the config you used?

plugins:
  - serverless-webpack

custom:
  awsId: ${file(conf/env/${self:provider.stage}.json):AWS_ACCOUNT_ID}
  webpack:
    includeModules: true

service: sls-api

provider:
  name: aws
  stage: ${opt:stage, 'local'}
  region: us-east-1
  stackName: sls-${self:provider.stage}-stack
  apiName: sls-${self:provider.stage}-rest-api
  memorySize: 256
  timeout: 30

package:
  individually: true

resources:
  Resources:
    GatewayResponseDefault4XX:
      Type: "AWS::ApiGateway::GatewayResponse"
      Properties:
        ResponseParameters:
          gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
          gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
        ResponseType: DEFAULT_4XX
        RestApiId:
          Ref: "ApiGatewayRestApi"

functions:
  authorize:
    handler: src-node/events/apiGatewayAuthorizer.do
    runtime: nodejs12.x

  secure:
    handler: src-node/endpoints/secure/_lambda.do
    runtime: nodejs12.x
    events:
      - http:
          path: /secure/{proxy+}
          method: ANY
          cors: true
          authorizer: authorize
      - http:
          path: /secure/
          method: ANY
          cors: true
          authorizer: authorize

  sns-handler:
    handler: com.example.HandlerSNS
    runtime: java11
    memorySize: 1024
    timeout: 900
    package:
      artifact: "target/example.jar"
    events:
      - sns:
          arn: ${file(conf/env/${self:provider.stage}.json):SNS_ARN}
  • What stacktrace or error message from your provider did you see?
Error: ENOENT: no such file or directory, copyfile '/.../api/.webpack/sns-handler.zip' -> '.serverless/sns-handler.zip'
      at Object.copyFileSync (fs.js:1907:3)
      at ServerlessWebpack.copyArtifactByName (/.../api/node_modules/serverless-webpack/lib/packageModules.js:86:6)
      at /.../api/node_modules/serverless-webpack/lib/packageModules.js:133:66
      at arrayEach (/.../api/node_modules/lodash/lodash.js:530:11)
      at Function.forEach (/.../api/node_modules/lodash/lodash.js:9410:14)
      at ServerlessWebpack.copyExistingArtifacts (/.../api/node_modules/serverless-webpack/lib/packageModules.js:133:9)
      at ServerlessWebpack.tryCatcher (/.../api/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/.../api/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/.../api/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/.../api/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/.../api/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/.../api/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/.../api/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/.../api/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

Similar or dependent issue(s):

Additional Data

  • Serverless-Webpack Version you're using:
    Issue observed in 5.4.0 through 5.5.0

  • Webpack version you're using:
    5.24.4

  • Serverless Framework Version you're using:
    2.41.2

  • Operating System:
    Ubuntu 20.04

@j0k3r
Copy link
Member

j0k3r commented May 17, 2021

I guess this PR might fix the problem: #808

@j0k3r
Copy link
Member

j0k3r commented Jun 10, 2021

Could you test again using the 5.5.1? Thanks 🙏

@j0k3r j0k3r added the awaiting reply Awaiting for a reply from the OP label Jun 10, 2021
@ryan-maclaurin-group
Copy link
Author

I'm currently on holiday but will try it out at the start of next week. Thanks!

@ryan-maclaurin-group
Copy link
Author

Looks to be fixed with the 5.5.1 release. Thanks!

@j0k3r j0k3r removed the awaiting reply Awaiting for a reply from the OP label Jun 17, 2021
@j0k3r j0k3r added this to the 5.5.1 milestone Jun 17, 2021
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

2 participants