-
Notifications
You must be signed in to change notification settings - Fork 227
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
Using multiple runtimes and explicit artifact, receive Cannot access package artifact error #281
Comments
I found the real problem, Serverless changed the |
serviceDir and servicePath both are optional so we have to check. In index.ts, I'm setting both, because according to comments throughout Serverless code, they should actually be linked. Due to (I think) a bug, they're not. But there may be code that uses either/or, so they should both be set. Added setter and getter for this, to put that logic in one place. This doesn't fix serverless#281 yet, but it's a necessary part.
This works at least for our needs. As part of `copyDependencies`, we copy any artifacts if a function specifies one into .build/.serverless/$(basename artifact) if it is a relative path. It seems absolute paths already worked but it makes 0 sense to use those.
+1 experiencing this exact problem with mixed project (golang + typescript). @vectorjohn do you recommend any workaround for this problem ? |
Has there been any movement or workarounds on this? I've got a project that is traditional java that I'm migrating to nodejs. I'll have both a java artifact and using serverless-plugin-typescript and am experiencing the exact same issue mentioned above. Rather not hack the code myself unless I need to. Any help is appreciated! |
Hi, We have experienced the exact same issue on our Serverless Framework project. We ended by migrated our stack to SST (https://sst.dev) ; because now it support correctly an API with both Java and TS endpoints... And this is only the top of the iceberg. It's easy to deploy your web app in SST too 🤓 |
Hard to describe, but this is when using multiple runtimes, and the other runtime has manual packaging. So we use the
package.artifact
configuration in serverless.yml, e.g.:When I try to package or deploy (e.g.
sls deploy
), after compiling the typescript it fails with this error:This seems to be caused by the code in
index.ts
in thecompileTs
function, with this line:this.serverless.config.servicePath = path.join(this.originalServicePath, BUILD_FOLDER)
Since this doesn't get cleaned up until the very end, it messes with other parts of the serverless build process. That path seems to be where serverless looks for my
artifact
.For reference:
Environment: linux, node 14.19.3, framework 3.22.0 (local) 3.22.0v (global), plugin 6.2.2, SDK 4.3.2
This exact serverless.yml used to work in Serverless v2 so perhaps they changed something, but from what I can tell the bug still lies in this plugin.
Here is a full serverless.yml for testing:
The text was updated successfully, but these errors were encountered: