Closed WeaponizedLego closed 2 years ago
Will be fixed with #243
After doing research as part of https://github.com/serverless/serverless/issues/9873 I've realised that layers are generally not supported by this plugin so this issue should still be open.
The general problem here lies in the fact that when packaging files for layers, layer.path
property is used as a prefix https://github.com/serverless/serverless/blob/f096440440dfb2339b4fd1ae1ecbca3b59fb4805/lib/plugins/package/lib/packageService.js#L272 however, the logic in the plugin changes the serviceDir
to point to .build
directory, which means that in most scenarios nothing will be available under serviceDir/<layer.path>
.
@pgrzesik any workarounds you know of other than webpacking the ts files ourselves?
Hello @abdullahmonoar - the only workaround I know is switching to serverless-webpack
or serverless-jetpack
:(
I can also confirm it works by using serverless-jetpack
Any timeframe for the issue create above ^ ?
@alexandrubese PR's welcome!
@medikoo this looks old, but that seems to be addressing the issue: https://github.com/serverless/serverless-plugin-typescript/pull/128
@raiseandfall great thanks for pointing. I've reached out to author of the PR to eventually update it so it's in sync with master
Since there wasn't any movement on this from the original author, I updated https://github.com/serverless/serverless-plugin-typescript/pull/128 and submitted it again which fixes this issue https://github.com/serverless/serverless-plugin-typescript/pull/267
@medikoo if you could take a look, I'd love to get this merged so layers work :) Thanks!
So the above PR fixes part of the issue, but not fully. It seems this only helps if the thing you want to put in a layer is something that would be packaged by this plugin. However, if it's an external file that wouldn't be included in the TS build, this is still broken with the same error.
We've also been hit by this problem, any update?
It seems we have the PR: https://github.com/serverless/serverless-plugin-typescript/pull/267
So the above PR fixes part of the issue, but not fully. It seems this only helps if the thing you want to put in a layer is something that would be packaged by this plugin. However, if it's an external file that wouldn't be included in the TS build, this is still broken with the same error.
I just ran into this and feel like it the commit needs to be reverted. I'm not sure exactly what case allows it to succeed. Is it checking for patterns: include because that is deprecated in serverless v3.
@tachang any clue on how to tackle the problem in some way?
I have a module in src/layer/shared/nodejs/node_modules/myd-api-utils/src/index.ts
Locally everything works just fine but I cannot deploy it since it breaks during the CI process
@tachang any clue on how to tackle the problem in some way? I have a module in
src/layer/shared/nodejs/node_modules/myd-api-utils/src/index.ts
Locally everything works just fine but I cannot deploy it since it breaks during the CI process
same here
the error still there 😢
Still seeing this error as of January 2024. Take the layer out of serverless.yml and the plugin works fine. Put the layer back in, and I get the same error reported above. Layer code in the YML looks like this:
layers:
shared:
name: hcapps-file-xfer-shared
path: layers/shared
description: Shared functionality for file transfer system
compatibleRuntimes:
- nodejs18.x
compatibleArchitectures:
- x86_64
retain: false
I don't see anything in here that should be considered weird.
We've written our own build system for using TS with serverless but I was really hoping to ditch that and use the plugin. We make extensive use of shared layers though, so this is kind of important. I'll admit I could be screwing something up, but at this point I feel like I've tried every reasonable config option (and again, it works fine with the functions - it's just the layer that breaks)
Edit to add: there is nothing in /layers
except a file called shared.ts
Im experiencing No FIle Matches include / exclude patterns when using the new AWS Lambda layers
here is the last part of the logs
and this is my layers and plugins