Hi guys, can anyone please help with a serverless ...
# seed
g
Hi guys, can anyone please help with a serverless build, I get this error on Seed and just not sure what might be causing it cause locally it works all fine:
Copy code
ERROR: `serverless package` failed to generate deployment package. This could be because the build is running out of memory. Try a larger build machine or contact us if the problem persists.
a
Within your project, go to the settings tab and then choose the service in service settings and update the build machine from
Standard SG
to
Medium SG
. That should do the trick, I guess.
First here :-
Then here :-
Then change this:-
g
I’ve upgraded to the Medium already still the same
a
oh, how much time does it take to build the project on your local machine? Maybe try the large variant as well.
g
the error that shows up internally is this, so weird cause I don’t get this on my local
and using the same version as on Seed
a
is your serverless-framework version a fixed version or is it a range and do you commit your lockfile in the repo or not?
g
it’s the latest - whatever is installed within the project
a
could you share your yml file here?
g
it’s pretty simple…
Copy code
service: api-gateway

projectDir: ../../

plugins:
  - serverless-deployment-bucket

custom: ${file(../../serverless.common.yml):custom}

provider:
  name: ${self:custom.provider.name}
  region: ${self:custom.provider.region}
  stage: ${self:custom.stage}
  deploymentBucket:
    name: <secret>
    serverSideEncryption: AES256

resources:
  Resources:
    ApiGatewayRestApi:
      Type: AWS::ApiGateway::RestApi
      Properties:
        Name: ${self:custom.stage}-api
    ApiGatewayApiKey:
      Type: AWS::ApiGateway::ApiKey
      Properties:
        Enabled: true
        Name: ${self:custom.stage}-ApiKey

  Outputs:
    ApiGatewayRestApiId:
      Value:
        Ref: ApiGatewayRestApi
      Export:
        Name: ${self:custom.stage}-RestApiId

    ApiGatewayRestApiRootResourceId:
      Value:
        Fn::GetAtt:
          - ApiGatewayRestApi
          - RootResourceId
      Export:
        Name: ${self:custom.stage}-RestApiRootResourceId

    ApiGatewayApiKeyId:
      Value:
        Ref: ApiGatewayApiKey
      Export:
        Name: ${self:custom.stage}-ApiKeyId
a
My serverless linter gives a lot of issues with this .yml file. There’s probably some referential issue with it. I am not used to dealing with .yml files so that’s the most I can assist right now.
g
thanks mate, thanks for trying to help
figured it out, in case anyone stumbles upon this - apparently I can use a custom parameter with any other value, but the provider name… so I had to switch
name: ${self:custom.provider.name}
to hardcoded
name: aws
in all the serverless.yml files and it all automagically worked. I’m not sure why I can’t have a common provider set outside and just reference to it - it works locally just not on seed
a
awesome, glad you figured it out.
f
@Ashishkumar Pandey thanks for chiming in 😁
g
@Frank any idea why the provider name via variable doesn’t work? all ok locally, but not via Seed…
f
@gligor hmm… can you double check on the version? Can you run
sls -v
locally in the same directory of
serverless.yml
, and on SEED add a
before_build
hook and run
sls -v
inside the same directory, and share the output for both here?
g
Hey @Frank yeah, I was using the same version both locally and on Seed:
Copy code
Framework Core: 2.64.1 (local)
Plugin: 5.5.0
SDK: 4.3.0
Components: 3.17.1
f
Hey @gligor, sorry for the late follow up. Are you still getting this error? Can you DM me a link to the build on SEED where package variable is not getting picked up?
g
Hey @Frank, I shut down the dev stage where I was testing this, so I don’t have a link to it anymore
I’ve gone with the workaround where the provider is named specifically within each serverless file, but the other provider details are coming from a common yml
f
I see. Yeah I remember from a while back that Serverless Framework didn’t support variable provider
name
. It seems they support that now.
Thanks for the details.
g
yeah, that’s why I was puzzled why it worked on my local
thanks for looking into this