Code Monkey home page Code Monkey logo

Comments (5)

aalej avatar aalej commented on August 16, 2024

Hey @unxavi, thanks for the detailed report. Sorry to hear you encountered this issue. I’m trying to reproduce this locally, but so far I haven’t encountered the same behavior. I’m able to load the environment variables during testing.

I created this repo to try and replicate this, let me know in case I may have missed anything or made a mistake in the setup. By any chance, if you could provide an MCVE, please share it as it would help us narrow down the cause of the issue.

Also, could you share your firebase-debug.log file? It contains a detailed log that we can use to check what caused the issue. Please remove any personal identifiable information(PII) before sharing the file.

from firebase-tools.

unxavi avatar unxavi commented on August 16, 2024

Hi @aalej thanks for your response. Maybe is me who is making something wrong.

I have realize that using fetch api is working as expected. I was using node16 from before and I was making a mock for the request and response (I will try to provide you an example with this later on) and that way the helper functions doesn't seem to see the env variables.

But anyways I have made a pull request aalej/issues-6871#1 on your repository of a failing test, the case would be of setting up for example a service to send emails and unit test it. You can see that my helper test does not load the value of the env files.

from firebase-tools.

inlined avatar inlined commented on August 16, 2024

The repro doesn't reproduce a failure as described. The actual test against the function passes I can even confirm it with your log statement:

console.log
      Hello message from local! I am a function. From your demo project with clientId ClientId123

The failing test is trying to load the utility method directly in the jest process, which doesn't have the params injected.

from firebase-tools.

aalej avatar aalej commented on August 16, 2024

Hey @unxavi, I tried to reproduce this issue again after merging the PR you created(thanks for submitting that). Similar to what’s mentioned above, it looks like the test is failing because it’s trying to access a parameterized variable outside a Cloud Function's runtime and execution.

Since this currently looks like it’s working as intended, I’m going to go ahead and close the issue. However, if you feel like the current repro we have may be different from the issue you’re encountering, feel free to ask this to be reopened and share an MCVE with us so that we can investigate further.

from firebase-tools.

unxavi avatar unxavi commented on August 16, 2024

@aalej I understand that and if I found anything else I will get back to you.

The thing is that the "old" system "Environment configuration" using the config() which was the recommended way, that use to work correctly doing this kind of tests where you don't pass through the cloud function itself. Now migrating a big project from the old recommended way to the new way it's pain.

from firebase-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.