Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

.serverless and .serverless_nextjs should be included on .gitignore? #415

Closed
kyun opened this issue May 25, 2020 · 12 comments
Closed

.serverless and .serverless_nextjs should be included on .gitignore? #415

kyun opened this issue May 25, 2020 · 12 comments

Comments

@kyun
Copy link

kyun commented May 25, 2020

I wonder .serverless and .serverless_nextjs should be ignored or not.

because if I add .serverless to .gitignore and I pull my project to another PC, I can't deploy it on another PC.

I can see CNAMEAlreadyExists Error Code only.

CNAMEAlreadyExists: One or more of the CNAMEs you provided are already associated with a different resource.

So, now I don't add .serverless to .gitignore but I am a nervous little bit because I don't know it is fine.

If I should .serverless with .gitignore, how can I avoid CNAMEAlreadyExists Error?

@medv
Copy link

medv commented May 25, 2020

You should include .serverless in your repository until the serverless framework removes the need for this.

@kyun
Copy link
Author

kyun commented May 25, 2020

@medv you mean .serverless has no credential information which should be private?

@medv
Copy link

medv commented May 25, 2020

It just contains resource definition and their ARNs. You also don't need to include .next and .serverless_nextjs folders as they are just the result of a build, so will be re-generated on each build. The .serverless folder contains all your infrastructure ARNs, so it's important to include it for other machines to be able to resume deploying to the existing resources.

@drakejin
Copy link

drakejin commented May 25, 2020

Has any solution to commit without AWS resources' arns?
I think it's a little nervous about that.
As you know as terraform state can manage(upload) on AWS s3 bucket.
So, I wonder there Is a solution like a terraform case on the serverless framework.

about terrafrom reference link here:

@medv
Copy link

medv commented May 25, 2020

There are other recent issues here that demonstrate how to put .serverless into s3 and sync it during CI step:

#328 (comment)

@drakejin
Copy link

@medv Oh Yes, I didn't think about that.
That's solution fit on @zynkn @Drake-Jin .
It's awesome what manage .serverless state on S3 bucket If it were created
Thanks.

@tyler-ground
Copy link

Yeah, putting it in a remote file store is the way to go. In github actions, I S3 copy before deploy then S3 copy back after.

This has the problem of parallel deployments conflicting but it may not matter as I've re-deployed with slightly out of date infrastructure config and it still worked.

@GraemeAllanBryce
Copy link

This document from the CEO of serverless includes the statement

Every Component now stores its state automatically in the cloud, so you can easily collaborate on them and run them in CI/CD.

Does this mean that the .serverless folder no longer requires to be part of the repository?

It is mentioned in the docs of this project that serverless were working on a solution to store state - I assume that the above link was the announcement of this event!

@danielcondemarin
Copy link
Contributor

This document from the CEO of serverless includes the statement

Every Component now stores its state automatically in the cloud, so you can easily collaborate on them and run them in CI/CD.

Does this mean that the .serverless folder no longer requires to be part of the repository?

It is mentioned in the docs of this project that serverless were working on a solution to store state - I assume that the above link was the announcement of this event!

That is correct, however, to benefit from this the nextjs component needs to be upgraded to use the new serverless components version which introduced some breaking changes. I have already started working on the upgrade and should have more info on that soon.

@GraemeAllanBryce
Copy link

GraemeAllanBryce commented May 27, 2020 via email

@michaelgutierrez0
Copy link

This document from the CEO of serverless includes the statement

Every Component now stores its state automatically in the cloud, so you can easily collaborate on them and run them in CI/CD.

Does this mean that the .serverless folder no longer requires to be part of the repository?
It is mentioned in the docs of this project that serverless were working on a solution to store state - I assume that the above link was the announcement of this event!

That is correct, however, to benefit from this the nextjs component needs to be upgraded to use the new serverless components version which introduced some breaking changes. I have already started working on the upgrade and should have more info on that soon.

Hi Daniel,
Have you had any luck switching to this new version? I think it will help with my use case. My use case is that I would like to use the custom domain feature but with an environment variable. Currently I am using codebuild to run serverless. My issue is now I want to make a new code build for the beta env that uses an env var to set the domain name. The issue with this is that .serverless and .serverless_next have the domain name stored in them which is in the code repo. Thank you!

@dphang
Copy link
Collaborator

dphang commented May 22, 2021

I think this can be closed. With the CDK construct it should be easier to manage state via the CDK / and you can customize it, and there are other workarounds using the normal deployer (https://github.com/serverless-nextjs/serverless-next.js#cicd-multi-stage-deployments--a-new-cloudfront-distribution-is-created-on-every-ci-build-i-wasnt-expecting-that)..

Though we could possibly still upgrade to get parity for the legacy deployer (though not sure we will keep adding new configuration there if the CDK makes IaC easier)

@dphang dphang closed this as completed May 22, 2021
shibadog39 added a commit to shibadog39/boyaki that referenced this issue Mar 4, 2022
- serverless.ymlの追加
- [email protected]をインストール
  `yarn serverless`でawsへデプロイ可能
  3系ではエラーがでて進めないので旧バーションを指定している
  serverless-nextjs/serverless-next.js#2320
- また、.serverless/.serverless_nextjsをgitignoreに追加した。
  FYI: serverless-nextjs/serverless-next.js#415
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants