cc <@U01JB1UGDV4> that thing with reusing the func...
# general
t
cc @Ross Coundon that thing with reusing the function multiple times I've been promising to fix should be fixed in this
r
Wonderful, thank you!
Just gave this a quick go and I get
Copy code
Error: There was a problem transpiling the Lambda handler.
    at Object.bundle (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:149:23)
    at Object.bundle (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:30:16)
    at new Function (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@serverless-stack/resources/src/Function.ts:338:39)
    at new OmwOfscBeStack (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/stacks/OmwOfscBeStack.ts:146:33)
    at Object.main (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/stacks/index.ts:117:3)
    at Object.<anonymous> (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/.build/run.js:94:16)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
We are referencing an esbuild plugin like so:
Copy code
props.bundle = {
      esbuildConfig: {
        plugins: 'config/esbuild.js',
      },
      externalModules: ['@thundra/core'],
      nodeModules: ['@aws-sdk/client-dynamodb', '@aws-sdk/client-sqs', '@aws-sdk/client-s3', '@aws-sdk/client-ssm'],
    };
app.setDefaultFunctionProps(props);
esbuild.js file looks like
Copy code
const { ThundraEsbuildPlugin } = require('@thundra/esbuild-plugin');

module.exports = {
  plugins: [
    ThundraEsbuildPlugin({
      traceableConfigs: ['src.main.*.*[traceLineByLine=true]'],
    }),
  ],
};
t
Yeah this is one of the breaking changes we did, you now have to return an array directly from your esbuild.js file
docs update might not have deployed initially but it's there now: https://docs.serverless-stack.com/constructs/Function#configure-esbuild-plugins
r
No, I did see that but misread it. I'll update and give it another go
Job's a good'un 😄
I was a bit hasty. Running the same build in Seed gives an odd error
Copy code
$ cd /tmp/seed/source
INFO: before_build hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
$ cd /tmp/seed/source/.
$ npx sst build --stage eon-test --region eu-west-2 --verbose
0.77 s
Unexpected token '.'
ERROR: There was an error synthesizing your app.
t
hm interesting
does running
sst build
locally give you the same problem?
r
Weirdly it builds fine locally
t
if it fails in 0.77s hmm
@Frank any idea?
f
Hmm… lemme take a look
Hey @Ross Coundon, I wasn’t able to reproduce this error deploying an app with SST 0.54.0 on SEED. Can you try redeploying an older commit (ie.
bc5d31f
from v56) and see if that works?
r
qwe`rz2tx3y45i6o7p8k9l0;-'=\
sorry, child
f
thought was ur password for 1 sec 😂
r
😄
Building now via the rollback button. It's already gotten past the previous point of failure
f
hmm.. interesting… it must be something related to the update or something within the update commit
I’ve actually never seen
sst build
fail like that
Unexpected token '.'
I will take a look at the code and see what can possibly trigger this error.
r
That makes two of us 😄 Thank you
I wonder if it's anything to do with the esbuildPlugin.js - it's defined like:
Copy code
module.exports = [
  ThundraEsbuildPlugin({
    traceableConfigs: ['src.main.*.*[traceLineByLine=true]'],
  }),
];
f
Hey Ross, think I found something. It seems you are using the General Purpose v3.0 build images https://seed.run/docs/seed-build-images#general-purpose-v30
They come with Node.js v12. And the error you were getting seems to be a Node12 specific issue.
I’m curious if you are using a newer Node version locally. Can you try switching the service to General Purpose v4.0, and give it a try?
r
Yes, we use 14.18.1 which matches the current version inside the lambda env
Is there a build machine that uses a later version or should I just define it in a pre build hook?
f
Yup, General Purpose v4.0 comes with Node.js 14 https://seed.run/docs/seed-build-images#general-purpose-v40
r
Cool, sorry, missed you'd said this when looking on my phone
I’m curious if you are using a newer Node version locally. Can you try switching the service to General Purpose v4.0, and give it a try?`
This did the trick, cheers
s
holy smokes, this is fast! 🔥
awesome work 👍
t
Hooray!