Apparently Pulumi thinks lambdas only go up to nod...
# aws
g
Apparently Pulumi thinks lambdas only go up to node 16...
Copy code
aws:lambda:Function (fn_auth_login_callback):
    error: aws:lambda/function:Function resource 'fn_auth_login_callback' has a problem: expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x nodejs16.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 python3.9 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 dotnet6 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2], got nodejs18.x. Examine values at 'Function.Runtime'.
Node 18 has been supported since 2022 https://aws.amazon.com/blogs/compute/node-js-18-x-runtime-now-available-in-aws-lambda/
s
Which AWS provider are you using?
l
That may be a provider version error. I remember that being resolved last year.
s
^ Exactly what I was thinking. AWS v6 shows support for all the latest runtimes, including Node 18.
g
Thanks both. I assumed since I freshly downloaded and installed Pulumi just a couple of weeks ago that I would be all up to date. I'll check out how to update the provider.
Copy code
% pulumi plugin ls    
NAME            KIND      VERSION  SIZE    INSTALLED    LAST USED
aws             resource  6.0.2    513 MB  1 month ago  1 month ago
aws             resource  5.16.2   419 MB  3 weeks ago  3 weeks ago
aws-apigateway  resource  1.0.1    92 MB   3 weeks ago  3 weeks ago
str             resource  1.0.0    24 MB   1 week ago   1 week ago
time            resource  0.0.16   38 MB   4 days ago   4 days ago

TOTAL plugin cache size: 1.1 GB
warning: A new version of Pulumi is available. To upgrade from version '3.94.1' to '3.94.2', run 
   $ curl -sSL <https://get.pulumi.com> | sh
or visit <https://pulumi.com/docs/install/> for manual instructions and release notes.
I guess it may be using the old one for some reason? how would that happen? I don't recall ever explicitly specifying the version
I deleted the older provider using
pulumi plugin rm resource aws 5.16.2
which worked fine. But on doing
pulumi preview
it seemed to reinstall it and I got the same error about the node version.
Copy code
% pulumi plugin ls
NAME            KIND      VERSION  SIZE    INSTALLED      LAST USED
aws             resource  6.0.2    513 MB  1 month ago    1 month ago
aws             resource  5.16.2   419 MB  7 minutes ago  7 minutes ago
aws-apigateway  resource  1.0.1    92 MB   3 weeks ago    3 weeks ago
str             resource  1.0.0    24 MB   1 week ago     1 week ago
time            resource  0.0.16   38 MB   4 days ago     4 days ago
I have not specified the provider version anywhere. How do I make it use version 6?
l
Destroy and recreate. Each resource notes which provider deployed it, and uses that. You might be able to comment out the lambda code, run
pulumi up
to destroy just that, then put the code back in and redeploy. That will put the correct dependencies into the lambda zip. I'm not certain that's actually where the error is, but it's the worst case scenario. If the problem is just that the local run of
pulumi up
is failing, then removing your local dependency cache should be enough.
g
I destroyed the entire stack, deleted the plugin, then did
pulumi preview
and it still wants to download the older provider. I also specified
aws:version: 6.0.2
in the stack config file.
l
Then you must have an explicit dependency on the old provider. Maybe via AWSX or a local dependency?
g
I do use awsx for a couple of resources. Not sure what a local dependency is. However I just realised that the
preview
succeeded now without the error about the nodejs version. So although something is still using the older provider, at least the lambda is now previewing with the newer one (it seems). Thanks for talking it through with me.
Hopefully we will get some traction on this issue: https://github.com/pulumi/pulumi/issues/7702 If this had been in production it would not* have been so easily resolved.
l
A local dependency would be a dependency in your project. package.json, requirements.txt, or whatever is appropriate for your language. If you dependent on another project, and it depends on the wrong providers version, then you'll transitively inherit that wrong dependency.
awsx probably uses only peer dependencies in Node, but I don't know how that works in other languages. So you may end up with the wrong version of AWS if you're using AWSX.
g
Thanks, I see. I'm using yaml and it's a fresh new project from scratch so no local dependencies anywhere. I guess it must be the awsx
m
AWSx v2.0.2 was released on October 18 with a dependency on AWS v6. Before that, it was v5. Also, note that generally you don’t need to destroy your stack to upgrade a provider version. Pulumi uses what’s referenced from your program, via your programming language’s dependency mechanism like npm/pypi/etc.