Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jeff Scott
    @JeffWScott
    Nevermind :)
    Rainer Selvet
    @tiivik
    Hey guys, is anyone aware if Netlify function executions are guarded by some kind of abuse control (Like AWS WAF)? Let’s say you deploy a public function accessible from site.com/api what would stop someone spamming that endpoint with thousands of requests and exceeding your plan limit? Just tried running Apache Benchmark against one of my functions on Netlify and running a couple thousand invokations in ~2 sec goes through.
    siliconchild
    @siliconchild

    The issue with this is I think after the function goes to sleep the cached variable gets deleted, another issue is the first API Call takes a long time to finish. I'm also getting some errors while running this code

    (node:19101) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'statusCode' of undefined
        at callback (/home/sc/web-projects/ecomm/node_modules/netlify-lambda/lib/serve.js:35:42)
        at /home/sc/web-projects/ecomm/node_modules/netlify-lambda/lib/serve.js:68:7
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    
    UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

    I don't why that is as i have provided try{} catch{} and then .catch methods.

    Can someone guide me to a better solution or critique me on how i can better implement what i am trying to achieve. Thank You.

    Gabor Gyarmati
    @gaborgyarmati

    Hi Guys, I am receiving 502 on netlify even though it returns the content string. Anybody experienced this before?

    It returns my content in the error header, and returns "Http failure response for https://demos-portal.netlify.com/.netlify/functions/get-demos: 502 OK" in the message

    Wispy
    @wispyco
    Does anyone know if Netlfiy functions work with Gatsby cloud, so far it works in Development Locally and In netlify build but get a 502 response on netlify cloud?
    Oh I think I didn;t put the env variables in gatsby cloud
    sorry a 504, still testing
    Wispy
    @wispyco
    still getting a error now I get this
    Error occurred while trying to proxy request sendmail from riel-design-2611766185.gtsb.io to http://localhost:9000
    Dani Tulp
    @DaniTulp
    @wispyco Have you figured this out by chance?
    Wispy
    @wispyco
    Gatsby support told me they dont allow port 9000 to be used on gatsby cloud
    Marco Melilli
    @marcomelilli
    Hi guys, i'm trying "Gatsby Builds" to build my site and hosting it on netlify. Do you know if there is a way to integrate netlify functions? After the build, if I try to reach the endpoint I receive a 404. If I build it with netlify it works well
    Nicolás Salvo
    @NGSalvo_twitter
    Hi, i'm struggling with a nested function in typescript when trying to build. I'd made a script on package.json "postbuild": "netlify-lambda build src/functions". In src/functions there are 2 nested functions -> src/functions/hello-world/hello-world/ts && src/functions/node-fetch-node-fetch.ts. When building I got an error: "---Start netlify-lambda notification---
    WARNING: No valid single functions files (ending in .mjs, .js or .ts) were found.
    This could be because you have nested them in a folder.
    If this is expected (e.g. you have a zipped function built somewhere else), you may ignore this.
    ---End netlify-lambda notification---".
    If, for example, hello-world is not nested (src/funtions/hello-world.ts), then it's works and the function get build in the path chosen in the netlify.toml file. Thus also work the invoke function with netlify dev.
    I'm doing this because if i have a dependency with a function, i dont want to have in the main package.json, I want it inside my nested functions. Do you know how to proceed?
    Mike Mahon
    @jetstreamin
    @NGSalvo_twitter include the zip in the lambda, you can add it in the ui
    Nicolás Salvo
    @NGSalvo_twitter

    @jetstreamin what you mean to include the zip in the lambda? You mean to transpile the files and move the files? Maybe i'm not clear, sorry.
    The warning says that I could have my functions in nested folders which is true in my case. But i do not know what to do. Maybe is a thing with netlify-lambda or most probably with misconfiguration from me.
    By putting all my typescript functions in the same level (that means inside functions's folder) the files are transpiled to javascript and moved to the correct folder described in netlify.toml. But I want them to keep the structure that I want inside a folder with the same name as the function name, just like it's in the docs of netlify-dev.
    Working structure:
    functions
    ¦_node-fetch.ts
    ¦_hello-world.ts

    What I desire:
    functions
    ¦_node-fetch/node-fetch.ts
    ¦_hello-world/hello-world.ts
    Because i want to have my functions with their own package.json
    The vanilla javascript functions works well with the folder structure that I desire.
    Thanks for the response!

    Mathias Bøe
    @mrboen94
    Hi guys, I'm pretty new to gatsby and netlify when it comes down to actually make a larger project in it. I am at the point where I need to use some API keys and have stored them in netlify. I need to access them though and have no idea where to start really. The keys can in theory be public, but I'd rather not share my API keys (its bad practise, but you know this). Anyway, I just need a pointer to know where I should start as I am currently in the dark here..
    Taliesin Beynon
    @taliesinb
    Hello all. Enjoying lambda functions in Netlfiy so far. Question: I have a function that is generating small amounts of data, and I'm looking for a service where I can POST JSON and have it appended to a big, dumb log, such that later I can just download it for analysis. I don't need querying or anything like that. Logging solutions like loggly and timber.io are great but they are expensive and they have limits on how long they'll keep the data. I just want something dumb and cheap. Any ideas?
    Jon Dujaka
    @jondujaka
    hey @taliesinb , I just came across the same need. I'm actually considering just writing to a google sheet.
    Or the other option is to use your CMS' content API and add it somewhere in there.
    Jon Dujaka
    @jondujaka
    @mrboen94 hey Mathias, what you're actually looking for is Enviroment variables. You can set these variables in the Netlify dashboard, and then access them in your code through process.env.VARIABLE_NAME.
    https://docs.netlify.com/configure-builds/environment-variables/#declare-variables
    Xiaofeng Liao
    @xiaofengleo
    Hi All, I am new to netlify. I am trying to follow the example at https://github.com/elastic/search-ui/tree/master/examples/elasticsearch, which includes a Netlify Function to proxy with the Elasticsearch instance locally. I got an error saying: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:3000/.netlify/functions/search. I googled and didn't find much info similar to my settings. Could any one give a hint? Thank you all.
    Vegim Qehaja
    @gimi-q
    using netlify functions to call: firestore.collection("helloworld").doc('test').set({ data: 'test', }) makes the netlify function timeout when deployed any ideas?
    Alex Chiu
    @chiubaca_twitter
    Hi All, just joined to say I'm also experiencing some issue running Firebase Firestore queries like @gimi-q above. Also running a very simple query which works perfectly fine locally when running Netlify Dev, but when published I'm seeing the error 2020-07-05T16:37:05.769Z 2ed6bae0-3702-441a-97b3-ad7cece3e9de Task timed out after 10.01 seconds . What's really weird is that I can see the output being returned correctly in the logs. Also looking for some advice , hope someone can help!
    Peter
    @peter-wd-1
    Hi, I’m using netlify cli and thought it would be nice If I can test with AVA and $ netlify functions:invoke myfunction --payload “graphql query payload”. Do you think its posible to implement?
    sandun-rezg
    @sandun-rezg
    I am having an issue in AWS lambda nodejs 12.x. I am trying to get data from another rest api using https module. It seems the code is not executing (only https module part).
    let dataString = '';
    const req = https.get(apIUrl, function(res) {
    res.on('data', chunk => {
    console.log(chunk);
    dataString += chunk;
    });
    res.on('end', () => {
    console.log(dataString);
    });
    });
    console.log(dataString);
    V2K Hacker
    @v2khacker
    Hi. I'm trying to implement rate limiting by updating app_metadata and I'm going by this is an example: https://www.netlify.com/blog/2018/03/29/jamstack-architecture-on-netlify-how-identity-and-functions-work-together/ However, I'm not getting any answer back from /.netlify/identity/admin/users/... You can see my code at https://github.com/v2khacker/sapper/blob/master/functions/transaction.js The last console.log I get is the HEADERS on line 48.
    V2K Hacker
    @v2khacker
    I figured out my problem. I forgot to put default after my node-fetch require, so I needed: const fetch = require('node-fetch').default
    Sammy
    @picosam
    Hello all! Are there any examples out there on how to deploy lambda functions along with the lambda layers they use to netlify?
    Sammy
    @picosam
    Well, I suppose that's a "no" :-)
    Matt Gregg
    @itwasmattgregg
    Anyone know why a function named with a dash in it would return a 403? Works fine using netlify dev locally but once deployed it doesn't work. Removing the dash and having a single word makes it work fine.
    Matt Gregg
    @itwasmattgregg
    Actually I figured it out: you can't make a function called submission-created and hit it externally. It's reserved for form submissions. So don't go making any custom functions with these names lol https://docs.netlify.com/functions/trigger-on-events/#available-triggers
    Felipe Silveira
    @Silve1ra
    Hello, I'm trying to host a static folder using netlify-lambda but it is not serving, just router is working.
    Does anyone have an idea how to solve this?
    const express = require("express");
    const serverless = require("serverless-http");
    
    const app = express();
    const router = express.Router();
    
    app.use(express.static('model'));
    
    router.get("/", (req, res) => {
      res.json({ message: "api working!" })
    });
    
    app.use("/.netlify/functions/api", router);
    
    module.exports.handler = serverless(app);
    Javed Ahmadzai
    @theahmadzai
    Hi, I'm using netlify functions with gatsby, the function is working fine but response.json() throws an error
    function url: https://pantherspainting.com/.netlify/functions/rating-count
    code: https://github.com/theahmadzai/pantherspainting/blob/master/src/pages/services.js#L17
    the function is returning valid JSON but the fetch is behaving like it is not getting valid JSON, it also keeps reloading the page in dev mode.
    function code:
    exports.handler = async () => {
      return {
        statusCode: 200,
        body: JSON.stringify({ ratingCount: 5 }),
      }
    }
    Javed Ahmadzai
    @theahmadzai
    Fixed!! the issue was ./netlify instead of /.netlify
    such a . can ruin your day
    Javed Ahmadzai
    @theahmadzai
    Is fetching the rating and ratingCount on build time with gatsby-node using graphql schema customization a good practice?
    Yaser Noorollahi
    @yasernoorollahi
    I have an error in running search-ui on NGINX, can anyone help me?
    I just deployed search ui on a host with SSL certificate and got this error
    netlifyerror.PNG
    This error occurred when i deployed it to NGINX
    Yaser Noorollahi
    @yasernoorollahi
    server
    {
    listen 443 ssl;
      #server_name _;
      server_name test.com; 
    
      ssl_certificate /etc/tech.crt;
      ssl_certificate_key /etc/tech.key; 
      root /var/www/html;
      #root /usr/share/nginx/html/; 
      index index.html; 
      auth_basic "Private Property";
      auth_basic_user_file /etc/nginx/.htpasswd;}
    Richard Cox
    @coxrichuk

    Does any know if Lambda supports Node Streams?

    For example

    router.get("/", (req, res) => {
        req.pipe(new stream.Transform(...)).pipe(res);
    });

    This works perfectly locally, but as soon as it's deployed the response time is almost doubled.

    Credentech Stack
    @stack-credentech
    I have a issue on lambdalayer, I try to place my typeorm entity under /lib/nodejs/ folder. Anybody help would be helpful . Thank you in adavance
    Patrick Ray. Huang
    @phuang07
    hello, I am getting an error saying "Could not proxy request /.netlify/functions/search from localhost:3000 to http://localhost:9000", could someone shed a light on what would causing such error? thanks
    Priscilla Pi
    @priscillapi
    Hello, I was wondering if anyone has added any third-party log management tool like Loggly or LogDNA to their Netlify Serverless Functions?
    Sachin Mittal
    @101_mittal_twitter
    How to autowire dependencies inside a lambda class which extends MicronautRequestHandler?
    Sachin Mittal
    @101_mittal_twitter
    ??
    Jarrett Lusso
    @jclusso
    is there a good way to write a function that can redirect based on accept-language header. for example I want to put a function at /* to check and conditionally redirect. can a lambda function return out and let Netlify shadow the page that exists at the given path?