Open rohit-ravikoti opened 7 years ago
Same here.
wt create http://code.affiliategenius.com/webtask.js --name AffiliateGenius --secret privateKey=__PRIVATE_KEY__ --parse-body --meta 'wt-node-dependencies'='{"affiliategenius-test":"1.0.15"}'
Result:
Resolving 1 module...
Provisioning 1 module...
affiliategenius-test@1.0.15 is available
Webtask created
You can access your webtask at the following url:
https://wt-607887792589a1d1a518ce2c83b6dddd-0.run.webtask.io/AffiliateGenius
As you can see below, from the http://code.affiliategenius.com/webtask.js
file (update: no longer available), it requires a simple npm package that’s dynamically loaded via the --meta
tag:
'use latest'
var AffiliateGenius = require('affiliategenius-test@1.0.15')
module.exports = (context, callback) => AffiliateGenius(context, callback)
Yet the resulting webtask says it’s not available:
Compilation failed: Cannot find module 'affiliategenius-test@1.0.15'
It appears that my above-referenced issue only shows up for code located on a website (in my case, http://code.affiliategenius.com/webtask.js
). Modules are properly loaded if a webtask is created using a local file instead:
wt create ./webtask.js --name AffiliateGenius --secret privateKey=__PRIVATE_KEY__ --parse-body --meta 'wt-node-dependencies'='{"affiliategenius-test":"1.0.15"}'
Your above example, @rohit-ravikoti, is from a local file, so it looks like my issue is not related.
Recommended Action: I would recommend the Webtask team add a reminder to the module chapter in docs that webtasks cannot load dependencies if web-based code is being used.
When using lokka with lokka-transport-http: