cloudflare / serverless-cloudflare-workers

Serverless provider plugin for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
175 stars 37 forks source link

Error: [{"code":7000,"message":"No route for that URI"}] #27

Closed casertap closed 5 years ago

casertap commented 5 years ago

I am having this issue

Error: [{"code":7000,"message":"No route for that URI"}]
    at module.exports.logError (/home/pc/Documents/workspace/cloudflare-country-redirect-workers/node_modules/serverless/lib/classes/Error.js:92:11)
    at initializeErrorReporter.then.catch.e (/home/pc/Documents/workspace/cloudflare-country-redirect-workers/node_modules/serverless/bin/serverless:62:3)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at /home/pc/Documents/workspace/cloudflare-country-redirect-workers/node_modules/serverless/bin/serverless:60:9
    at Object.<anonymous> (/home/pc/Documents/workspace/cloudflare-country-redirect-workers/node_modules/serverless/bin/serverless:63:4)

My deploy script is pretty simple

service:
  name: country-redirect-workers
  config:
    accountId: ${env:CLOUDFLARE_ACCOUNT_ID} 
    zoneId: ${env:CLOUDFLARE_ZONE_ID_MY_DOMAIN}

provider:
  name: cloudflare

plugins:
  - serverless-cloudflare-workers

functions:
  redirectmydomain:
    name: redirectmydomain
    webpack: false
    worker: redirectmydomain
    script: redirect
    events:
      - http:
          url: my_domain.com
          method: GET

I tried different version of serverless 1.31.0 or 1.39.0 and serverless-cloudflare-workers 1.1.0 or 1.0.10 without success.

This is my package.json

{
  "name": "cloudflare-country-redirect-workers",
  "version": "1.0.0",
  "description": "Cloudflare serverless deployment for self-serve customers",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "cloudflare",
  "license": "MIT",
  "devDependencies": {
    "serverless-cloudflare-workers": "1.1.0",
    "serverless": "1.31.0"
  }
}

I run it using the local install of serverless

source ../.env && SLS_DEBUG=* ../node_modules/serverless/bin/serverless deploy
casertap commented 5 years ago

I had some credential issue. I did not set the export CLOUDFLARE_ACCOUNT_ID right. Thanks

longbkit commented 5 years ago

I had the same issue. A lady in Cloudflare showed me that account_id is not email address. You can go to the cloudflare dashboard, click on worker and find account_id on the bottom right. It is 32 characters string.