Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Gina Trapani
    Hello world!
    Paul Ford
    Hello, Gina.
    Adam Pash
    Roberio Moreira
    Hi Gina!
    Harshdeep Singh Hura
    Anyone had luck deploying mercury?
    On Firebase funcitons* ^
    It would be nice to have instructions to run it on a non Amazon server too, or is that a too digital vegan thing to want?
    Adam Pash
    @kinngh I haven't tried it on a Firebase function, but it should work the same as anywhere else. Have you had trouble with that?
    @harmavenso What did you have in mind? Our API repo runs on serverless on AWS, but deploying to an AWS server would look a lot the same — you'd just need to have a working server and deploy pipeline https://github.com/postlight/mercury-parser-api/
    Harshdeep Singh Hura
    @adampash I am stuck with things. I added the package as a dependency in packages.json , and because I lack the JS knowledge, I am stuck with actually building the index file
    @adampash yeah, i found that out after posting my question. Thanks !
    Adam Pash
    @harmavenso great!
    @kinngh have you deployed anything with dependencies to a firebase functions before?
    Babak Fakhamzadeh
    Pardon the ignorance. I don't grasp the distinction between the mercury parser and the mercury parser API. In my projects, I use CURL calls to something like https://mercury.postlight.com/parser?url=".$site["link"]. What do I need to do to keep this working after the Web Parser API is shut down?
    Babak Fakhamzadeh
    @harmavenso I also would like to install on a non-Amazon server.
    Adam Pash
    @MastaBaba Mercury Parser is the library that powers the Mercury Parser API. You could run Mercury Parser in any JavaScript code directly without ever calling an API. In fact, if you're only using curl now, you could actually use the mercury-parser cli tool as described in the README here https://github.com/postlight/mercury-parser/#usage
    if, on the other hand, you'd still prefer to be able to call an API to get your parsed response, that's what the Mercury Parser API repo is for: https://github.com/postlight/mercury-parser-api/
    If you follow the instructions to deploy that to AWS, you can continue calling the API as you've been doing — just with a new base url.
    Babak Fakhamzadeh
    Thanks @adampash. When I look at a command like "import Mercury from '@postlight/mercury-parser';", as mentioned in the README for the parser, I do not know where I am doing this import. If, for the API, the 'installation' as listed in that README is for deploying to AWS, I'm really lost; I'd think that the first step of deploying to AWS would be something like setting up some kind of environment on AWS, no?
    Haoji Xu
    Hello everyone! Is there any way I can use Mercury parser in browser? I looked around and did not find any documentation about such usage but docs implied I can do this.
    Harshdeep Singh Hura
    @adampash I don't have any experience running JS / firebase functions tbh
    Adam Pash

    @MastaBaba The import would happen in your javascript code. If you're not writing javascript/node, that's not something you'd need/want.

    Re the API: No, the only step to deploying to AWS using that repo is making sure your AWS credentials are set up as described in the README. Other than that, it uses the Serverless framework to provision and deploy your code to AWS. It doesn't run in a server — it runs on AWS Lambda, with API Gateway providing you with a URL to make requests.

    @HaojiXu Yes, you can run Mercury in the browser. Usage is the same, though one caveat is: If you're trying to parse URLs outside of your domain, you could run into CORS issues, depending on the policy of the site you're trying to parse.
    @kinngh I think your best bet, then, would be to look into deploying the Mercury Parser API https://github.com/postlight/mercury-parser-api/
    Babak Fakhamzadeh
    Thanks again, @adampash. I'm still not completely clear on the import; I run my javascript in scripts included in PHP pages. I don't use yarn or npm.
    On the serverless framework; In a nutshell, if I understand this correctly, I first have to use npm to install serverless framework, then use git to clone the repo, yarn to install, serve and deploy it. While at some point I have to put my AWS credentials in the code. Yeah?
    Adam Pash
    @MastaBaba Mercury isn't hosted on a CDN, and more likely than not, you want to run Mercury in a Node environment, not a browser environment. you don't have to put your AWS credentials in the code. all you need to do is set up your aws credentials using the aws cli https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration
    Bryan Hackett
    Do we need to run nodejs8.10 locally for the API? I encountered this error attempting to deploy using v11.9.0.
        throw err;
    Error: Cannot find module '..'
    Bryan Hackett
    @adampash Could you post an example IAM json policy to use with this? Thanks!
    Bryan Hackett

    I got this to finally work:

        "Version": "2012-10-17",
        "Statement": [
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                "Resource": "*"
                "Sid": "VisualEditor1",
                "Effect": "Allow",
                "Action": "apigateway:*",
                "Resource": "arn:aws:apigateway:*::*"

    But it feels like there are probably more permissions than needed.

    Adam Pash
    :point_up: February 13, 2019 8:47 PM I'm not completely sure about this, but could you please try with 8.10 and if you still experience this error, let me know?
    @BryanHackett_twitter it's true that one drawback to the serverless framework is that it requires a lot of access (a lot of ppl end up just using admin privileges, which isn't exactly ideal). I think this is a decent post on the ins and outs of IAM requirements for serverless
    Bryan Hackett
    @adampash Thanks. Everything worked when I manually set the mercury parser dependency to 2.0.0.
    Adam Pash
    Hi all, i have a Problem, i am a Mac/iOS Developer that relies on the Mercury Parse API for one of my Apps, now i am looking for a way to install the Code on my own Server, but its not a Root or AWS, its just a hosting PHP Server and i have no clue how to do this.
    Is there any tutorial or way to install the API without NodeJS or YARN? (just by uploading all Files and call a Script with parameters like http://www.myserver.com?parse=whater url)
    Adam Pash
    @atoxx Unfortunately if you want to use our out-of-the-box solution (mercury-parser-api), you'll need to use AWS for that. if that's not an option, you'll need to either use yarn/npm to install the cli or have some sort of javascript code to run the parser.
    Thx for clarifications, sorry it seems i am out of luck on this, maybe there might be a mirrror APi endpoint or an alternative Install Tutorial one day 11
    Harshdeep Singh Hura
    So figured out how to deploy the mercury-parser-api on Lambda, and got it working, but here's the thing: I have function invocations, about ~300 of them while I have made only 2-3 requests? Is it because of the pinging every 5 minutes to avoid cold start?
    Adam Pash

    @kinngh That's correct. If you don't want to keep your function running, you can remove the scheduled events by commenting out these lines:


    And these:


    Tom Lai
    Hi. Thank you for this open source project. It seems that the import statement in code sample doesn't work for typescript. It worked after I changed the import statement to the following. Thanks!
    import * as Mercury from '@postlight/mercury-parser';
    Hi, I'm a bit of a newbie developer and I have a question. I was previously using the Mercury API inside a Chrome Extension. Now that it's gone would my only option be to include Mercury in extension? Meaning I would have a folder, mercuryFiles, with all the files from github and just import it inside the main file with import Mercury from "./mercuryFiles/src/mercury.js" and then I can do something likeMercury.parse(url).then(result => console.log(result))?
    Adam Pash
    @underTheFunSun_twitter You have two options:
    1. You could include Mercury directly in your extension. I don't know what your extensions build steps look like, but if you can use npm modules, you can install it and import/require it into your projects the same way you would any other dependency.
    2. Alternately, you could deploy your own Mercury Parser API drop-in replacement. This process is detailed here: https://github.com/postlight/mercury-parser-api