json-serverless
json-serverless copied to clipboard
update-stack not updating data even though JSON has been changed (now more of a feature request to tell people how to update the db.json on AWS)
Describe the bug
update-stack seems to deploy but does not actually update the JSON data in the API. Note: running locally works perfectly. Swagger shows proper data locally but not on AWS version after update-stack
. Maybe worth noting that the db.json in the deployment folder has been updated. Just seems that it's not being uploaded/deployed. As a work-around, I am having to create a brand new Lambda stack every time I edit the JSON (can't keep doing)
To Reproduce
Deploy a JSON jsonsls create-stack ../DB/db.all--.json
Make a change to the JSON shape.
Run local:
jsonsls run ../DB/db.all--.json
[Works great]
Update the deploy with the exact same DB:
jsonsls update-stack ../DB/db.all--.json
...passes all the tests and "deploys", but the deployment is the old JSON data
Have done this several times. Does not update the API. Swagger still shows old fields and old results (using the new link that the script generates)
Check AWS Identity... done
✔ Validate JSON Serverless Directory
✔ Copy Template Files
✔ Update AuthSettings
✔ Update Appconfig
✔ Validate JSON Serverless Directory
✔ Validate JSON Serverless Directory
✔ Validate JSON Serverless Directory
✔ Copy Template Files
✔ Update AuthSettings
✔ Update Appconfig
✔ Update Dependencies
✔ Build Code
✔ Deploy Stack on AWS
The Api proto-api has been successfully deployed
Check swagger (using the new link provided in the terminal after deploy). See nothing has changed
Expected behavior jsonsls would update the swagger and API with the new JSON data
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- MacOS, Node 14.9.0
Hey David,
please delete the file in the s3 bucket after you executed the stack update. After that the first request will recreate the file in the s3 bucket with the new content.
You can chain this together as well...
- sls update-stack
- aws s3 rm
- curl api-url
Hope this helps.
br,
pharindoko
Thanks again for this super useful tooling. Appreciate it a lot.
I figured it out by trial & error… (for anyone coming along later), You
have to run command:
aws s3 rm s3://jsonsls-<api_name>/db.json
after the update-stack deploys and it will copy the newly deployed db.json
into that bucket when you hit the API next
You may want to make note of this in the docs and maybe even the command
line output after the update-stack completes. Would be even better if the
CLI would ask you if you want to invoke that command, since it knows the
URLs already, and it can do it for you if you say Y
.
Anyway, this is super helpful. Thanks again!
On Fri, Sep 17, 2021 at 1:14 PM, Florian Fuß @.***> wrote:
Hey David,
please delete the file in the s3 bucket after you executed the stack update. After that the first request will recreate the file in the s3 bucket with the new content.
You can chain this together as well...
- sls update-stack
- aws s3 rm
- curl api-url
Hope this helps.
br,
pharindoko
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pharindoko/json-serverless/issues/829#issuecomment-922055358, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEI6VA7QF46ONSJGSFOOFDUCOOTRANCNFSM5EIHPGYA .
I remember that I had describe it in the readme: https://github.com/pharindoko/json-serverless#update-content-of-dbjson
But you`re right - when you wrote this I thought the same. Would be nice to make this easier and give the user the choice to update the file immediately. Additionally the versioning for the bucket can be set. So no data loss but direct updates.