question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AJV Schema should accept useDotenv=false

See original GitHub issue

In version 2.14 configSchema.jscontains useDotenv: { const: true }, but falseis a valid value cf https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/

Also deprecation warning LOAD_VARIABLES_FROM_ENV_FILES should not be triggered when useDotenv=false.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:77 (44 by maintainers)

github_iconTop GitHub Comments

17reactions
medikoocommented, Sep 17, 2021

We’ve decided (internally) to revert from deprecation notice, and in v3 we will keep the very same behavior as it’s in v2 (.env files will be loaded by the Framework only if useDotenv: true setting is set).

The reasoning is that we’re worried to break for users which already use .env files to configure the environment for lambdas, where the same root folder is shared by both service configuration and lambda logic

PR that removes the deprecation in v2 will be introduced in the next days (once it’s in, we will close this issue)

6reactions
Nyholmcommented, May 17, 2021

I understand. I see this may bring much value for other users. I dont think it is a bad idea and Im not trying to stop it.

However, for my specific use case (and most likely others in this thread). It is useless.

  • I have no benefit that Serverless is reading .env files
  • I cannot opt-out from this
  • It may conflict with values unrelated to Serverless that I’ve already specified in .env
  • It removes all my .env files before creating the zip archive which will break my production environment

That is why Im would like to see a way to say “This application does not need Serverless to care about my .env files”.

There are other suggestions from @chekalsky, @mnapoli, @jer-sen that also make sense for me. Im no expert in the internals of Serverless, I just wanted to share some input.

(This is written with much love and appreciation of course)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ajv options - Ajv JSON schema validator
Usage. This page describes properties of the options object that can be passed to Ajv constructor. For example, to report all validation errors...
Read more >
API Reference | Ajv JSON schema validator
Validating function returns a boolean value (or promise for async schemas that must have $async: true property - see Asynchronous validation).
Read more >
draft 2020-12 - Ajv JSON schema validator
In a simple way, JSON Schema is an object with validation keywords. The keywords and their values define what rules the data should...
Read more >
Type coercion rules - Ajv JSON schema validator
In this case the validating function will try coercing the data to each type in order until some of them succeeds. Application of...
Read more >
Managing schemas - Ajv JSON schema validator
Re-using validation functions​​ Ajv validation model is optimized for server side execution, when schema compilation happens only once and validation happens ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found