pulumi / templates

Templates used by `pulumi new`
Apache License 2.0
102 stars 66 forks source link

The "hello-aws-javascript" template still using prerelease AWSX version #674

Open scottslowe opened 11 months ago

scottslowe commented 11 months ago

What happened?

The hello-aws-javascript template works, but it is using a prerelease (0.40.0) version of AWSX. Unfortunately, simply updating package.json to ^1.0.0 doesn't work. When you make that change, pulumi up reports:

Diagnostics:
  pulumi:pulumi:Stack (tmp-dev):
    error: Running program '/Users/slowe/Work/Code/Repos/pat/tmp/index.js' failed with an unhandled exception:
    TypeError: Cannot read properties of undefined (reading 'API')
        at Object.<anonymous> (/Users/slowe/Work/Code/Repos/pat/tmp/index.js:7:38)
        at Module._compile (node:internal/modules/cjs/loader:1218:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
        at Module.load (node:internal/modules/cjs/loader:1081:32)
        at Function.Module._load (node:internal/modules/cjs/loader:922:12)
        at Module.require (node:internal/modules/cjs/loader:1105:19)
        at require (node:internal/modules/cjs/helpers:103:18)
        at Object.<anonymous> (/Users/slowe/Work/Code/Repos/pat/tmp/node_modules/@pulumi/cmd/run/run.ts:430:33)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/slowe/Work/Code/Repos/pat/tmp/node_modules/@pulumi/pulumi/cmd/run/run.js:18:58)

Example

  1. In an empty directory, run pulumi new hello-aws-javascript.
  2. Remove the node_modules directory and package-lock.json.
  3. Edit package.json to specify ^1.0.0 for AWSX.
  4. Run pulumi up.

Output of pulumi about

CLI
Version      3.88.0
Go Version   go1.21.2
Go Compiler  gc

Host
OS       darwin
Version  13.5.2
Arch     arm64

Backend
Name           pulumi.com
URL            https://app.pulumi.com/slowe-pulumi-corp
User           slowe-pulumi-corp
Organizations  slowe-pulumi-corp, zephyr, pulumi
Token type     personal

Pulumi locates its logs in /var/folders/c_/1pdwtg4j5zx4dvx5t6qp9v180000gn/T/ by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

desteves commented 11 months ago

Ref: https://www.pulumi.com/blog/building-your-first-serverless-app-using-only-javascript/

desteves commented 11 months ago

Per @interurban 28 visits over the last 3 months

scottslowe commented 11 months ago

This doesn't feel like it should be a template, but maybe rather an example. The blog post gets decent placement for "pulumi javascript" so we probably shouldn't remove the blog post, but perhaps we can rework the blog post not to depend on this template so that we can sunset this template entirely.

desteves commented 10 months ago

I'll add a new issue to track the efforts to update the referenced blog post and link to this issue.

desteves commented 10 months ago

Course of action: move to /examples.

cnunciato commented 10 months ago

This template is referenced elsewhere on the web, though -- it goes back to 2018. Moving it will break all references to it (one of which is a blog post apparently updated as recently a few weeks ago):

https://www.google.com/search?q=%22hello-aws-javascript%22

If we can update the template in place, why wouldn't we just do that? We'd need to do it anyway if it moved to examples, and fundamentally it's no less a template than serverless-aws-typescript is when you think about it. Both do roughly the same thing: provision a serverless endpoint, output a URL. The only thing that makes this template a little different is its name.

Is there a benefit to having the template not live in this repo? Is that benefit strong enough to cause anyone who runs pulumi new hello-javascript after reading one of these blog posts (ours or someone else's) to get an obscure error about the template not existing and being stuck? I'm not sure I'd say so.

I'd prefer we kept this template where it is and updated it as needed. There's really no great reason to break this IMO -- and I must admit, it's also kind of neat having it there for Pulumi-historical reasons. 😄