Skip to content

Commit

Permalink
just use fetch I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Apr 4, 2020
1 parent 6fa26db commit 3c93292
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 46 deletions.
10 changes: 10 additions & 0 deletions functions/process-url/node_modules/.yarn-integrity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions functions/process-url/package.json
Expand Up @@ -4,7 +4,5 @@
"main": "index.js",
"author": "christopherbiscardi <chris@christopherbiscardi.com> (@chrisbiscardi)",
"license": "MIT",
"dependencies": {
"cloudinary": "^1.20.0"
}
"dependencies": {}
}
26 changes: 0 additions & 26 deletions functions/process-url/process-url.js
@@ -1,41 +1,15 @@
const cloudinary = require('cloudinary').v2
const qs = require('querystring')
cloudinary.config({
cloud_name: process.env.CLOUD_NAME,
api_key: process.env.CLOUDINARY_KEY,
api_secret: process.env.CLOUDINARY_SECRET,
})

exports.handler = async function (event, ctx) {
const {queryStringParameters} = event
console.log(queryStringParameters)
try {
// https://res.cloudinary.com/dg3gyk0gu/image/upload/v1586032616/og-images/pixel.png
// const imageUrl = cloudinary.url(`v1586034934/og_images/pixel_zeddhz.png`, {
// // resouce_type: "raw"
// sign_url: true,
// // secure: true,
// custom_pre_function: {
// function_type: 'remote',
// source: `https://competent-goodall-d71d0d.netlify.com/.netlify/functions/gen-opengraph-image?${qs.stringify(
// queryStringParameters,
// )}`,
// },
// })

const imageUrl = `https://res.cloudinary.com/${
process.env.CLOUD_NAME
}/image/fetch/${encodeURIComponent(
`https://competent-goodall-d71d0d.netlify.com/.netlify/functions/gen-opengraph-image?${qs.stringify(
queryStringParameters,
)}`,
)}`

console.log(
`https://competent-goodall-d71d0d.netlify.com/.netlify/functions/gen-opengraph-image?${qs.stringify(
queryStringParameters,
)}`,
)
return {
statusCode: 302,
headers: {
Expand Down
17 changes: 0 additions & 17 deletions functions/process-url/yarn.lock
Expand Up @@ -2,20 +2,3 @@
# yarn lockfile v1


cloudinary@^1.20.0:
version "1.20.0"
resolved "https://registry.yarnpkg.com/cloudinary/-/cloudinary-1.20.0.tgz#88f3964be91cc9808b5c7834bf06e03d22954636"
integrity sha512-/e76lEr5PS5gefvWUJ2Ou90zuEQCc0agTq8hrx2uxfFhUGlzEQ9mPPcwAeHFY1gj9caq0iHLuvTDvBbLSRhX9w==
dependencies:
lodash "^4.17.11"
q "^1.5.1"

lodash@^4.17.11:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==

q@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=

0 comments on commit 3c93292

Please sign in to comment.